Let’s say you’re looking to invoke a .py file from Alteryx…
Take a look at the macro workflow. You’ll see 4 ‘Control Parameter’ tools at the top. Below each is an ‘Action Tool’. All are affecting the configuration of the ‘Run Command’ tool. Below that, a simple ‘Text Input’ tool passes a datetime field into a select tool, which helps confirm the datetime is formatted correctly. A Formula tool follows, replacing the original 1899-01-01 00:00:00 datetime with DateTimeNow(). This isn’t particularly relevant, except a Run Command tool requires either an input or an output and so we’re providing an input to in turn output a little file that write a last run time record.
If you need to call four arguments, you might opt to have four separate action tools, as depicted here, or to instead concatenate four fields into one and pass that concatenated field into one. Below, I’ve chosen to write in 4 unique placeholder arguments into the ‘Command Arguments’ field. Each will be uniquely addressed by a pair of tools chained together to substitute in a replacement payload from the parent workflow.
As depicted below, There are four unique ‘placeholder’ args in the ‘Arguments’ field in the ‘Run Command tool. They are 1st 2nd 3rd 4th. Each has its own ‘Action Tool’ and in turn a ‘Control Parameter’.
The Control Parameter simply labels the component being edited. In my example, the 1st Arg gets labeled consistently for the placeholder string and in the Control Parameter label.
You can see how the ‘Action Tool’ is configured below:
Lastly, the easy parts:
You’ll load the macro with 4 arguments from your data source. In this case, I’m just using a ‘Text Input’ Tool. I only want my py file to run once, so in this case I’m content with passing only one record into the Macro. Pretty simple.
You’ll configure the macro such that the 4 fields from your data are correctly aligned to the 4 arguments of the macro. In the example, I tried to ensure accuracy by assigning the 4 fields names that match the numeric order they’ll need to be used with the py script.