ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now
2 Day Countdown - The Alteryx Community will be temporarily unavailable for a few hours due to scheduled maintenance starting on Thursday, April 22nd at 5pm MDT. Please plan accordingly.

Alteryx Designer Discussions

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

Passing a row_count value as an iteration number

Teresa31
6 - Meteoroid

Hi,

 

I would like to know whether it would be possible to change iteration number in accordance with the chosen file. 

 

My first attempt was to connect 'file browse' tool to 'drop down' tool, so that the number of records within the file would be input as the iteration number. However this does not seem to change the iteration number. 

 

Any help would be greatly appreciated! 

 

Teresa31_0-1614755835811.png

 

Qiu
17 - Castor

@Teresa31 

I believe we need to move the Interface Tools outside of the Macro.

And A batch macro is the one we should use?

Attached is only a sample.

Capturef1.PNG

Teresa31
6 - Meteoroid

Hi @Qiu,

 

Sorry for not catching up with our previous question, but I did take a look and found that iterative macro would better serve the intended purpose rather than batch macro.

 

So.. I was wondering if it would be possible to pass the row count as an iteration number outside the macro as you mentioned.

 

Many thanks!


 

Qiu
17 - Castor

@Teresa31 

Can you check if this works for you. Please note it is just the idea, and you need to fine tune it into your really work process.

Capturef2.PNG

danilang
17 - Castor
17 - Castor

Hi @Teresa31 

 

It's not possible to change the Engine.IterationNumber.  It starts at 0 and is incremented by 1 each iteration.  What you can do is change the filter where you're checking it.  Instead of [Engine.IterationNumber]+2=7, use something like [Engine.IterationNumber]+[Offset]=7.  Pass [Offset] into your macro, allowing to you control when the filter condition is met.  

 

Dan

Teresa31
6 - Meteoroid

Hi @danilang

 

Thank you for the reply! Maybe I was a bit misleading, I wanted to update max iteration number, not each engine iteration number (as highlighted below).

 

Teresa31_0-1614778953661.png



@Qiu , Thank you for your response as well. I am taking a look at your workflow and this taught me that iterative macros can take in more than one macro input. I am still in the process of incorporating this idea into the intended workflow. 

danilang
17 - Castor
17 - Castor

Hi @Teresa31 

 

There's no way to update the max iteration number, either.  However, there are 2 stopping conditions for an iterative macro

 

1. Max iterations is reached.

2. The Iterative Output has 0 records

 

The second way is the one you want to look into.  In your macro use [Engine.IterationNumber]<[MaxIterations]-1 in a filter to control whether or not to pass any records to the iterative output.  See the attached for an example

 

Dan

Labels