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.
Hi @TheOC,
Thank you very much for your reply.
Unfortunately, I couldn't open your attachment. I have Alteryx Designer 2020.2 x64 (User).
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.
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"
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"
I tried to shuffle around the configuration of the Macro and Input Macro but errors still appear.
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
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:
Then I apply a filter, with Year = 1995, so that it works for this example data
Then I add a control Parameter, and drag it to the lightning symbol on the filter tool, this creates an action tool.
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:
Then i just add a summarize tool with the following configuration and a macro output:
This should run with the following output:
now i save this, create a new workflow, and drag in both my data and the new macro:
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:
Last step is to define the control parameter at the bottom of the questions tab of the macro to the year field:
Running that, should work fine!
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.
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?
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):
am i correct in thinking you want the output to be like: