Iterative Macro - Rerun whole data set
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi all,
I was wondering if it possible to rerun a workflow with all the original input data depending on a condition using an iterative macro.
In my workflow I run a check to see if the pair of employees matched together have the same manager using a formula tool. This creates a new column called 'Manager Check' which says 'OK' if the pair don't have the same manager or 'ERROR' if the pair do have the same manager.
I know you can filter the 'Manager Check' column and send the data with 'ERROR' back through the workflow however I am wondering if there is a way to send all the results back through the whole workflow if there are any results containing 'ERROR' in the Manager Check column?
I hope this makes sense!
Thanks,
Abby :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello @AbigailShaw
It sounds like you are trying to impose a conditional statement on the whole table instead of just the individual records. I have attempted to solve this using the following method:
1) Use the formula tool to create a "Manger Check" column. If two people share the same manager the get marked with "Error" in this column.
2) Filter to all records where the "Manager Check" column equals "Error", the count how many there are.
3) Append this count back to every record in the table.
4) If the count equals 0 then all the records will be filtered out of the true anchor towards the main Output.
If the count doesn't equal 0 (i.e one or more pair share a manager) then all the records will be filtered out of the false anchor towards the Loop output.
5) The select tools are simply to drop the Manager check and Count column.
Please find the macro attached below.
I hope the above all makes sense but I'm happy to expand further if needed. Please let me know how you get on.
Regards - Pilsner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Pilsner
Nice approach. We can see the use of this kind of looping condition in the AoC questions.😁
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you very much @Qiu .
That's exactly where I've learnt this from! I made it to around day 10 of AOC this year so I used this trick a fair few times in my solutions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Pilsner
I was really shooting in the blind. 😁
Good to know that you are also an AoC participant.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This is great thankyou so much! Do you know if there is a way to dynamically input data to the macro, ie have part of a workflow and have the results of that feed into the macro?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello @AbigailShaw
Glad to help!
Yes, if you want to have the output of a workflow feed into the macro, than you can simply create the workflow you want and then insert the macro into that workflow as it if were another tool. You can do this by right clicking the canvas then navigating to Insert > Macro > Browse.. > (wherever you have the macro saved).
If you need more than one input anchor for the macro then you can add more by opening up the macro, and simply inserting more "macro input" tools. This will make the too look more like this.
Here I have added another macro input for the date which is then appended on to the output. When adding more inputs, just make sure that you have the iterative input configured correctly in the Interface designer.
I hope this answers your question, please let me know how you get on.
Regards - Pilsner
