This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Is there a way to pass a variable (present in the input dataset) using control parameter (or by any other means) to a workflow? If yes, is it possible to get the parameter working throughout the entire workflow?
Example: I have a dataset with many amount variables (Amount1, Amount2, Amount3, etc). I need to pass one of these variables (let's say Amount1) as input to a workflow. The workflow should do all the calculations based on this one variable.
In the second case, I need to pass Amount2 and the workflow should do all the calculations using Amount2 now and so on.
Let's say I have a workflow (just an example) that just calculates the sum of each field. If I pass Amount1 to the workflow the result will be 1036. If I pass Amount2, result will be 1035 and same happens for Amount3.
Now I need to pass these field names dynamically. Based on the Input the workflow should produce the output.
Hope it is clear. If not please let me know. Thanks!
I'm not so sure if this is exactly what you're looking for..
But here is a way to pass your field as a parameter and modify tools.
The Macro itself is very simple. The control parameter will change the field being Summarized. So, anything you put in the Control Parameter will do that. To keep track of what is being Summarized, I also added a Text Input and Joined by Position, so I can say for example:
Amount 1 - got that sum of amount..
The workflow uses the Field Info tool to get the name of the Fields. So these names are passed in the Control Parameter, that way, every iteration that is run will change the Summarize tool, resulting in a different sum of amount depending on the field that was input.
I have one more question related to this. I am using a similar workflow with the only difference is I have two fields in Group By category in addition to the Sum calculation field.
Now if I pass my variable names through control parameters to change one of the Group By fields dynamically, I am getting an error stating "The field schema for the output "Output6" changed between iterations."
Since the behavior of batch macros is to union the macro outputs, the Macro Output schema must be the same every time. By renaming the Output Field Name in the Summarize tool, you can dynamically choose which attribute to group by while maintaining a consistent Field Name. If the data types are different (e.g. String vs Double, String(10) vs String(3)), you can pass a Select tool before the output to standardize it.
Do you know a way to use a macro with two different inputs for the control parameter? In the end I want to feed the macro with two different inputs, which will then change some property of two elements at the same time with their different input.
In your example there is one input going into the macro with the control parameter, also updating two elements at the same time but with the same input.