Alteryx Designer Desktop Discussions

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

Iterative macro, engine.iteration number increment by >+1

gfloresDiaz
5 - Atom

Hi,

 

I am trying to run a workflow with an iterative macro. My input data has 4K records, and I want my workflow to run in batches of 10 or 100 or 500. But when using the iteration number and macro, it will run the first time correctly, and then iterate +1 by +1 each of the remaining records.

 

On the image I have the example of iteration +10 for each, but as mentioned before it runs +1 and +1 until reaching the last record on my input.

 

Thanks

3 REPLIES 3
martinding
13 - Pulsar

Hi @gfloresDiaz,

 

The engine iteration is 0 indexed and increments by 1.

So it goes like 0, 1, 2, 3, 4 (+1) in each iteration.

 

I am not sure what exactly what you want to achieve,

but if the first one got the result you want (e.g. 10), then what you can do is to use multiplication instead of addition.

 

Batches of 10: ([Engine.IterationNumber]+1) * 10, so this goes like 10, 20, 30, 40, 50...

Batches of 100: ([Engine.IterationNumber]+1) * 100, so this is like 100, 200, 300...

Batches of 500: ([Engine.IterationNumber]+1) * 500 ....

 

DataNath
17 - Castor

Hey @gfloresDiaz, it's first of all worth mentioning that the [Engine.IterationNumber] is 0-based and so you may want to offset this by +1. Looking at the way you have this set up, you're just adding 10 to the number of times the macro has ran (again starting at 0 due to the nature of the variable), so your first few runs will look like this in terms of the Filter's behaviour:

 

Run 1: [ID] <= 10

Run 2: [ID] <= 11

Run 3: [ID] <= 12

Run 4: [ID] <= 13

Run 5: [ID] <= 14

and so on...

 

Which is why your workflow will just continue to run through each record, as you're only filtering one extra ID each iteration. If you want to batch each iteration into chunks of 10 as you say, you may want to create your [Count] by using something like:

 

([Engine.IterationNumber]+1)*10

 

That way, your first few runs would now be...

 

Run 1: (0+1)*10 = 10, Filter: [ID] <= 10

Run 2: (1+1)*10 = 20, Filter: [ID] <= 20

Run 3: (2+1)*10 = 30, Filter: [ID] <= 30

Run 4: (3+1)*10 = 40, Filter: [ID] <= 40

Run 5: (4+1)*10 = 50, Filter: [ID] <= 50

 

Hope this helps, apologies in advance if I've read into this incorrectly but please do let us know if that's the case, perhaps with some additional detail/context, and we can continue to work on a solution!

gfloresDiaz
5 - Atom

Thanks that is what I was looking for!

Labels