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
JosephSerpis
17 - Castor
17 - Castor

Hi @Neico it sounds like you need a batch macro as it will run per year in your data. This article explains how to get started with batch macros. If you have your workflow already built then turning into a batch macro shouldn't be too difficult. 

Neico
7 - Meteor

@JosephSerpis Thank you! I already had the feeling that it would be a batch macro. Is there maybe a template somewhere already that I can use and tweak?

JosephSerpis
17 - Castor
17 - Castor

Hi @Neico that article has links to example batch macros and also explains the batch macros that are part of the sample workflows that are located in Alteryx Designer and are installed by default. If you are able to share your workflow or an example with data I can mock up a batch macro for your specific example. 

Neico
7 - Meteor

Thanks again  @JosephSerpis 

I attached an extremely simplified workflow (different calculations) with dummy data. Instead of having to copy and paste the workflow and only changing the filter criterion in each year, I would like to have the workflow automatically run through each year and then simply have a union tool at the end, summarizing the outputs. Does that make sense?

Thanks for your help in advance!

JosephSerpis
17 - Castor
17 - Castor

Hi @Neico I mocked up an example for you and attached as an Alteryx Package the version of Alteryx I used is 2020.2. If you have an older version then an error will pop up when you try to open it. However these two posts show how to get round that error and open up the Alteryx package.

 

Post1

Post2 

TheOC
15 - Aurora
15 - Aurora

hi @Neico 

I managed this using a batch macro:

TheOC_0-1602456280327.png


This runs for each year value within the dataset. You will have to import the macro i have created, and create a workflow like so.

This produces your desired output. I have attached the workflow i have used too!

 

 

Hope this helps and hope you've had a great weekend!


Bulien
TheOC
15 - Aurora
15 - Aurora

After posting, I can see my answer is virtually the exact same as @JosephSerpis 's! Glad to see mine was a right methodology in this case! haha




Bulien
thuyduongnguyen
7 - Meteor

Hi @TheOC and @

thuyduongnguyen_0-1603718095362.png

 

 

error_macro.PNG => All field must be mapped for the "Input11"

error_inside_macro.PNG => Unknown variable [Location]

 

Also I'm confused with Macro Input: my dataset has nearly 100 columns.

There is a whole long process with multiple tools before coming to the macro at the end (see the original workflow).

Therefore I couldn't correctly configure the Text or File input as below:

macro_input.PNG

 

Attached files are my demo workflow and macro.

I have been searching for a concrete solution for months already.

Really appreciate for any help on improvement this workflow.

 

Thank you very much in advance.

Thuy Duong

TheOC
15 - Aurora
15 - Aurora

hi @thuyduongnguyen 

Sorry for delay in getting back to you!

Having a look at this, it looks like your macro input had 3 input columns, and anything in the macro input has to be mapped to something when you drag data into the macro. I removed these and that got rid of the "all fields must be mapped" issue.

Your second issue was your control parameter, you were trying to replace the value "1995" in your expression, but that doesn't appear in your expression (see bottom left):

TheOC_0-1603876778794.png

This was easy to just change to "Goerlitz" which is the value we want to change each iteration of the macro.


I now believe this works, I have had to change the input template file, so make sure you transfer it back. I also had to re-create the macro, as it was still asking for the fields in the macro input even when i deleted them.


Hope this helps!

 


Bulien
Labels