Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Alteryx Python package in macros returning incorrect values

lkdonne1
5 - Atom

Hi, I have been stuck trying to solve a problem in a macro my company uses to publish data to a server for a while now. The macro works correctly when only one instance of it is included inside a workflow, but when a second instance is included, only the data from one of the macros is published.

 

I have isolated the issue to the python script inside the macro that is used to publish this data. I did this by creating a copy of the macro and adding an output directly before the python tool that allows me to see in a workflow that the python tool is being given the correct inputs. And creating a test workflow that uses two of these macros to upload dummy data with different values and names.

 

Then, within the python tool when I print the name, and try to trace the problem, both of the macros within my test workflow print the same name showing me that the python tool within the macros are both reading the input of only one of the macros. I suspect that this is because of some problem with either the alteryx python package, or in how I am indexing the dataframe alteryx returns.

 

As an example from the code, here is how I access this data: 

# read in input data
Alteryx.getIncomingConnectionNames()
df = Alteryx.read("#1")
list_title = df.iloc[0]['Question.LibraryName']

df = Alteryx.read("#2")
file_name = df.iloc[0][0]

 

There is obviously more code, but I believe this is where the problem is, because when I call print(filename) both macros print the same name despite being given different inputs.

 

I appreciate any help. 

Thanks

2 REPLIES 2
apathetichell
18 - Pollux

what kind of macro? Is this a batch macro? This sounds like a classic batch macro issue where the action tool isn't accurately uploading whatever it's supposed to upload. I see this sometimes where it was used to manually run an instance and then wasn't properly reconfigured to the new input location.

lkdonne1
5 - Atom

This is a regular macro. The problem does sound similar though. Could you explain more why that problem happens, or link me to someone's solution to this problem? I am pretty sure the problem is in how I access the data in the ayx python package because I output the values directly before and during the python tool as the workflow runs, but I'd hope a similar problem has a similar solution. 

Thanks for the help

Labels