Ok, I’ll need to think about how best to achieve your requirement, but if it does turn out that looping is the way, then in general variables are reset on each iteration of the loop (as you have found). 2 port recursive loops are (I think!) an exception to this, but I would suggest using iteration only if it turns out to be necessary. Where possible I try to do things in Knime in terms of “sets” of data rather than in terms of iterating through individual rows. Although sometimes there is no choice but to iterate.
There are often many ways to achieve most things in Knime, and sometimes it’s personal preference, but it really depends on exactly what is required, so I need to completely understand and my apologies, but I’ve still not got this clear.
So may I reword this to checking if my understanding of this is correct:
For any given row where the amt_diff is not zero, find all other rows that have the same (but opposite i.e. + vs - ) value.
For all such rows found, write a column called “observation” with the word “Swing” in it
Should the word “Swing” also be written on the row that we are using as the comparison?
For the example input table that you’ve indicated:
what should the output table look like? Is this the expected output:
I’ve still not grasped the full significance of columns c1… c5. I understand they may change between rows but what difference does that make to your required output? Are you saying that if there are 3 differences between the rows between c1 and c5, than the observation would say “swing swing swing”?
What happens if there are two rows with 100 and two rows with -100? If any or all attributes in c1…c5 can change, then which rows would get compared, and how do you then decide what observations to write?