Nested variables loops

Sorry for this very basic question, but I’m lost.
Let’s assume that I want to create a table like the following using variables:

outer   inner   increment
0       0       0
0       1       1
1       0       2
1       1       3
2       0       4
2       1       5

I tried both counting loops and variable condition loops, with no success


Loop.knwf (37.1 KB)

The counting loop stops after some iterations, but the table has 3 rows only, instead of the 6 expected, and there is no increment to the inner variable. On the other hand, the variable condition loop doesn’t stop.

Could someone provide a hint on how to solve these problems?

Thanks in advance,
Piero

HI Pier,
Welcome
I didn’t see anything wrong in the first branch.
So I Simply replaced by a table instead of a variable loop. it worked , we have 6 interactions.
The flow is exactly what you have in the top branch


Now, to get the progression of the values we should work with the iterations variables otherwise we are only piling up the same row. : See attachment
Loop -Adrix.knwf (26.1 KB)

Hi @Adrix ,
thanks for your support: so, first error is to use variables instead of columns in the loop.
Now the issue remains in the incremental value: even replacing the column with the math formula
$increment$ + 1
it seems to have no memory, so it remains stuck to the first increment to 1: any hint on what is wrong?

Loop Tab.knwf (27.7 KB)

Hello
As far as my understanding, now It is doing what was designed for.
What was the end goal ? In each inner iteration the incremental should be grater ( +1) each iteration ?
It won’t happen because we are not working in table , so the loop is always the same row.
The last tool (loop end) is only pilling up the results . If there is need to make the incremental bigger you need to add the the interaction counter (

the catch here is understanding that the way this is designed that you are always working with the same row

PS-> Also need to move the comp tool to outside the inner loop
formula inside comp tool → ($${Doutrt_iter}$$+1)*($Iteration$+1)

3 Likes

Hi @Adrix ,
thanks for your clarifications an patience: I completely misunderstood the usage of columns and variables.
As an exercise, I did the same with the variable condition loop end, in case it helps someone else.

Loop.knwf (50.0 KB)

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.