Variable Condition Loop End

Dear all,

 

there is a problem with the Variable Condition Loop End, i am stuck with.

It throws a double row id error, however i have no idea why.

Here is the workflow. There is a bunch of dummy stuff in there, the error however stays the same.

 

 

I appreciate any help.

Cheers

Hi,

First of all, I suggest you clean up your workflows a little bit before uploading them. Sometimes you can already find the source of a problem this way.

Now on to the error: I think you found a bug. The loop end in question tests a variable, but it also collects the values of that variable and returns them in the second out port. However, instead of collecting the variable you specify inside, it always seems to collect any variable named "currentIteration". You can test this by replacing the outer loop by something simpler. The loop end now complains about not finding a variable of that name, although that name is specified nowhere. If the outer loop is connected, however, such a variable does exists. But the loop end also expects it to change in each iteration. It doesn't, and as a result, the node fails.

I guess this node is really only intended to be used in conjunction with a Generic Loop Start node, as stated in its description...

Workaround: overwrite the "currentIteration" variable manually inside the loop. It should be reset automatically after the end of the inner loop.

Unrelated problem: The code in Java Snippet #202 is never run, and thus the variable for the loop end is never changed. These Snippets are run once per row, so if no row is present, nothing happens. I suggest using a sequence of an Extract Table Dimension, a Table Column To Variable and a Java Edit Variable instead.

 

Cheers.

Hi Martin,

thank You for Your answer.

To bad the Variable Condition Loop End is buggy...

There are two follow up questions i have though.

First: what Do You mean by "overwirte the currentIteration"?
When i alter the variable to a fixed value (like 99), i am getting the error:

"ERROR Variable Condition Loop End Execute failed: Encountered duplicate row ID "Iteration 99" at row number 2"

When i alter the variable to something like: value=old-value+1, the Variable Condition Loop End, will throw an error in some of the following iterations.

Second: Thx for the hint about the empt row! An Extract Table Dimension knode does the job

Everything inside a loop is completely wiped when a loop cycles back, safe for some state in the end nodes. That makes it hard to keep a state for overwriting the variable, even as a "system variable".

Option 1: Compute the value from the known settings of the Interval Loop Start

Option 2: Do the inverse, by using a Generic Loop Start and computing the interval manually

Option 3: Replace the loop with a recursive one. At least here you can keep a state, if only in table.

 

Also: bugs like this, this odd choice to erase all state, the massive slowdowns loops cause, and a lot of other details in this area seem to be a sign that loops are still in their early stage of development. Loops can be really really helpful, and beautifully simple, but if you can see any way to avoid them, do so. You can achieve some crazy things with just the "normal" nodes. In the past, I've cut down hours of execution to minutes by replacing a loop I thought made things "simpler".

The variable condition loop end is missing a sanity check for the currentiteration variable. I added this to our bugtracking.

However, you can combine it with all loop start nodes which provide the currentiteration flow variable. (As the counting loop start, or the chunk loop start)