Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Repetitively run workflow for subset of data

Neico
7 - Meteor

Dear community,

 

I built a workflow for my panel data, which I would like to run subsequently for each year of observation i.e. if year = 1 then run workflow and store result. if year = 2 then run workflow and store result ... combine the outputs. How can I go about this without having to manually copy and paste the workflow over and over again? Perhaps a macro?

 

Thank you for your help!

 

14 REPLIES 14
thuyduongnguyen
7 - Meteor

Hi @TheOC,

Thank you very much for your reply.

Unfortunately, I couldn't open your attachment. I have Alteryx Designer 2020.2 x64 (User).

thuyduongnguyen_0-1603888536001.png

Anyway, I still tried out your suggestions:

1. Thank you for pointing that out, it lies at the bottom so it's completely out of my sight.

thuyduongnguyen_2-1603888862644.png

 

2. I replace my input macro with another one, leaving it blank like this. Then it has error: "At least one field must be selected"

thuyduongnguyen_1-1603888822272.png

If I insert 1 column in Text input, then again error at the filter: Parse error at char(1): Unknown variable "Location"

 

3.  Insert macro:

for Control GroupBy Field tab -> [None]

for Choose Field: Control Parameter -> Location (V_string)

Even for 2 cases of step 2 (1 or 0 column for Text input), I still got the error -> "A file must be specified"

thuyduongnguyen_3-1603889171963.pngthuyduongnguyen_4-1603889190990.png

I tried to shuffle around the configuration of the Macro and Input Macro but errors still appear.

 

 

 

 

 

TheOC
15 - Aurora
15 - Aurora

hi @thuyduongnguyen 

Thats okay, are you able to at all update your version of alteryx? Or if you click okay to attempting to open the workflow, what parts are broken?


If not, dont worry, i'll try to take a look/explain

Cheers,
Owen


Bulien
TheOC
15 - Aurora
15 - Aurora

hi @thuyduongnguyen 

In the case that you cannot update, dont worry!
I'm sure theres a better way of exporting a workflow for a version behind, but otherwise I'll explain step by step how to recreate the workflow I've attached and then you should be able to create it for yourself. I would recommend starting from scratch with this, and I'm sorry if this is a little over simplified/documented, its not to insult your intelligence just I don't know how to get you the workflow i created without you recreating it perfectly or potentially a teams screen share session.

I start with a fresh workflow for the Batch Macro creation, i drag on a macro input with the following text input:

TheOC_0-1603980293613.png



Then I apply a filter, with Year = 1995, so that it works for this example data

TheOC_1-1603980320092.png


Then I add a control Parameter, and drag it to the lightning symbol on the filter tool, this creates an action tool.

TheOC_2-1603980437145.png

 



I dont need to change anything in the control parameter, but i do need to change the action to update the field. Within the update value, i click the field i want to change - in this case the operand that is set as 1995:

TheOC_9-1603980904934.png

 


Then i just add a summarize tool with the following configuration and a macro output:

TheOC_4-1603980609090.png



This should run with the following output:

TheOC_5-1603980628247.png




now i save this, create a new workflow, and drag in both my data and the new macro:

TheOC_6-1603980699504.png


The add a summarize to group by yerar, apply it to the top side of the macro, and a connection straight from the data to the macro:

TheOC_7-1603980756502.png


Last step is to define the control parameter at the bottom of the questions tab of the macro to the year field:

TheOC_8-1603980790627.png



Running that, should work fine!

TheOC_10-1603980958050.png

 


Bulien
thuyduongnguyen
7 - Meteor

Hi @TheOC, I have read your explanation carefully.  

My problem is exactly at the Input Macro with the Text input.

Let's say my real input excel file has 100 fields (columns), I have a whole workflow to process the data and then at the end, I want to filter by [Location] but has to keep 100 columns in the output file as well. 

 

1.PNG

Let's say there are 6 Locations so there will be 6 output files in the end with the data corresponding to theirs locations only. 

I can't choose File input also because the macro lies in the middle of the process, not at the beginning.

But I really don't want to manually add 100 columns into the Text input. Is it the only way so all columns can get through the macro?

TheOC
15 - Aurora
15 - Aurora

hi @thuyduongnguyen 

No, theres multiple ways of doing this.

How do you want  the fields to be collated? Assuming lets say, New York has multiple rows, when put into one row, do you want the rows to be summed, or concatenated, assuming there are different values within the other fields.

i.e:
If your input is something like this (assuming theres a bunch more fields):

TheOC_0-1603986185629.png


am i correct in thinking you want the output to be like:

TheOC_1-1603986203305.png

 


Bulien
Labels