How to Loop with my Java snippet ?

Hi Guys,
I have a Dataset with, for example ID, position_x, position_y, speed.

I need to take ID 1 and calculate some values with the following ID 2, ID 3, ID 4…
If its through the whole Data, it will repeat. Take ID 2, compare values with ID 1, ID 3, ID4 …
Is there a Knime Loop to realise that ? I dont know how to manage that in my Java snippet. In Java itself, I would take some Arrays, counters and a loop to do this.

my first Idea was to use the group-loop. But when I group (ID) it , I have a single row with my actual ID (ID1 for the first Iteration) and nothing to compare it.

Thank you guys !

How about this? The java snippet node can be replaced by anything that you want to use for the comparison. The ID of the current row is available as a flow variable, which can be applied to all other rows. The row filter removes the current row so that the ID can be compared to the other rows only.

tmp

1 Like