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!
Solved! Go to Solution.
@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?
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.
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!
hi @Neico
I managed this using a batch macro:
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!
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
Hi @TheOC and @JosephSerpis
I also have similar issue but in a more complex context:
I have built a workflow (in red rectangle below) which dynamically change the Output file's name based on: Today's date + [Location] (1 field in input data) and still preserve the output formating. Currently I replicate this process 6 times as I have 6 different [Location] in my dataset.
I have tried to implement above suggestion:
1. Grouping [Location] using Summarize tool
2. Create a Batch macro
3. Add Filter for [Location] inside the macro and set it as Control parameter.
However, I still have errors and couldn't run the process:
=> All field must be mapped for the "Input11"
=> 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:
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
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):
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!