I am constructing a batch macro to run a set of operations in loop for a control parameter.
sample input A
Item | qts | place | id |
A | 23 | MMX | t6787 |
A | 11 | KKI | t6789 |
A | 88 | IUJ | t6791 |
A | 52 | YTT | t6793 |
sample input B
flag | flag_rate |
1 | 0 |
1 | 5 |
1 | 10 |
My macro basically should take these 2 inputs and runs a python code with "flag_rate" as a control parameter for each iteration and gives the final output. Since there are 3 values under "flag_rate" the macro should run 3 times and collate the results. However i do not want my input A to be changed.
How can i pass the input A without providing a groupby field?
@GaRaGe You will need a control parameter mapped to flag_rate and then you can have a macro input in your batch macro that input A connects to. There is no need to provide a grouping field.
How do i map the control parameter to flag_rate?
@GaRaGe Good question, I would highly recommend the interactive lessons if you haven't already checked them out.
I've put together a simple example with your sample data.
The flag_rate is being mapped on the questions tab:
Thank you very much for this. very useful
Does this work for a dynamic input A? because i extract the data from a DB that updates constantly and then i should run the macro over it with flag_rate as control parameter
Also why do i get this parse error in the solution you provided?
Hi @GaRaGe This would be allow for a dynamic Input A.
As for the flag rate error, I'll just walk you through how the macro is working exactly.
In my macro, when I placed the control parameter on the canvas, I renamed it to flag_rate here in the Name box at the top:
Now when I click on the canvas and then the workflow >>> configuration tab, I can give flag_rate a "test value" of 5:
Now I can use that control parameter variable in my formula tool:
When I click run in my macro, it will run my test value through (5). When I go back to my workflow and click run, it will run through the values from the dataset. FYI this method is called reference shortcut. Note that if you're in a macro and copy/paste an interface tool, it loses it's name.