Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Iterative Macro - Rerun whole data set

AbigailShaw
6 - Meteoroid

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 :)

 

 

 

 

 

6 REPLIES 6
Pilsner
11 - Bolide

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.

Screenshot 2025-02-25 174124.png


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

Qiu
21 - Polaris
21 - Polaris

@Pilsner 
Nice approach. We can see the use of this kind of looping condition in the AoC questions.😁

Pilsner
11 - Bolide

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.

Qiu
21 - Polaris
21 - Polaris

@Pilsner 
I was really shooting in the blind. 😁
Good to know that you are also an AoC participant.

AbigailShaw
6 - Meteoroid

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?

Pilsner
11 - Bolide

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).

Screenshot 2025-02-26 214440.png


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.

Screenshot 2025-02-26 215730.png


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.

Screenshot 2025-02-26 215358.png



I hope this answers your question, please let me know how you get on.

Regards - Pilsner




Labels
Top Solution Authors