Alteryx Designer Desktop Discussions

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

Iterative macro: Update the maximum number of iterations through macro configuration

uthailderton
6 - Meteoroid

I want to be able to input the maximum number of iterations through the configuration of the macro. I can't work this out and have tried nesting an iterative macro inside another macro but it doesn't allow you to change that. Is this even possible?

 

Background: I am doing fuzzy matching and looping through the Match Thresholds starting at 100 and dropping by 1 every iteration, currently my maximum iterations is 100 so the Match Threshold ends up at 0 for the final loop however if somebody wanted 85% as their Match Threshold I want to be able to enter 15 in the macro configuration without having to open the macro and change this (this is for when I send it out to others)

3 REPLIES 3
ggruccio
ACE Emeritus
ACE Emeritus

HI @uthailderton, there is a fairly complex way of doing what you are asking, although I've not attempted to do this with an iterative macro, but with chained apps....maybe it follows the same principle...

 

The idea is that you have to read the .yxmc file into alteryx as a .txt file with a delimiter \0, which allows you to get to the base xml.  You can then search for the expression you are looking to change (the row that contains the iterationLimit), do a find and replace. Then save it back as a macro....

 

Then run it in a downstream process once it's saved.  Think of chained apps, where you run app 1 that modifies part of app 2, then app 2 runs...to the user it is seamless.

 

I'd only recommend trying it if you do some research first - on chained apps and reading in files and modifying the xml....

 

I'd also recommend troubleshooting on a copy of your file in case you make any mistakes.

 

 

ggruccio_0-1586371676757.png

 

uthailderton
6 - Meteoroid

This will work as a solution however a bit complex I think when sharing workflows! Thanks for the reply

danilang
19 - Altair
19 - Altair

Hi @uthailderton 

 

While @ggruccio gave you a big hammer to solve this problem, there's another, simpler way to go about it.  It's based on the fact an iterative macro will loop until the iteration limit is reached OR there are no records pushed to the iterative output.  

 

danilang_0-1586445308839.png

 

In this macro I've add a text input where the user can enter the limit, say 85%.  The Filter tool passes records to the Iterative output as long as the MatchThreshold calculated in the Formula tool is greater that the Limit that the user has entered.  Once the limit is reached, there are no more records going to the I output so the macro will stop iterating 

 

Dan

 

Labels