Hello everyone,
i created a macro that counts the max value of an existing "ID" Column and then continues to count up from the MAX Value.
The results will be saved in a new column. The NEW_ID Value is therefor the ID Value + MAX Value.
Now i want to make that macro dynamic to make it able to do that operation on diffrent column names for my "ID" column.
Do you have a proposal to make that possible?
Thanks
Sincerely Gabriel
Solved! Go to Solution.
Hey @grandepaci,
Would you be able to provide you macro file? I would suggest adding a control parameter to your macro making it a batch macro:
This would let you pass a list of columns to apply your logic too and then dynamically apply your macro to the data.
Any questions or issues please ask :)
HTH!
Ira
Hi Ira,
thanks for your answer. I added the 2 Interface Tools, and the List does now recognize another ID value.
Unfortunately it now only adds 1 to the NEW_ID column instead of counting from 444 upwards as it should in the macro.
Are there any settings i have to change in the macro?
Thanks in advance.
Sincerely
Gabriel
Hey @grandepaci,
Is this more along the lines of what your looking for:
Could you give an example input and output?
Hi @grandepaci, your macro is fine it is just you were grouping the fields based on the ID column which was giving you results based on each id passed.
Also, in order to get the desired result as shown in the screenshot below you would need to add a summarize tool. to get the max_Id of the data passed outside the macro or it will multiply and create 9 iterations because you are appending the data inside the macro.
Attaching the workflow along, in case of any issues please let us know.
Thanks!
Hi again,
thanks for the explanation. I now understand the missing part in the macro.
The suggestion from @grazitti_sapna bring the right result. I also have reproduced that with a simple select infront of my macro.
I wanted to create a dynamic macro, that doesnt need any further tools infront of it.
I was thinking of inculuding an expression into my macro, that is only referening the biggest value of all my ID's. Like an expression inside the macro that replaces the sumarize infront of it.
Is that even possible?
Sincerely
Gabriel
@grandepaci, you can use a unique tool after the macro as the 9 rows are all duplicates which will give you unique result and you will not have to use any tool before macro input.
I hope this helps!
Thanks!
Hi @grandepaci
I think things might be being overcomplicated here. There's no need for batch macros.
With a macro input, you get the option to Show Field Map.
This will give users a drop down where they can assign a field to replace the one in the macro input.
If you connect the Q anchor of the macro input to an action tool, and then attach that action tool to a select tool before your macro output, you can 'Update Select with Reverse Field Map' which will rename the ID field back to whatever the field is called outside the macro:
So in a workflow this looks like this:
Hope that helps,
Ollie