Help required regarding loops

Hi,

I am stuck with a problem, i have a data (call it main _data) in which there are dates in a column. What I want to do is to perform some operations on it on the basis of another table containing dates(call it filter_data).

So here is the requirement, compare the main_data with each row of filter_table and increment the date in main_data if the dates in main_data and filter_data matches. So in term of programming, I have to loop the filter_data rows and compare it with the main_data in each iteration RECURSIVELY, and increment the dates in main_data.

What I am able to do till now is,

  1. Use “Table Row To Variable Loop Start” to get the rows one by one and end it with “loop end”. And perform operation in between. Problem is that it does not recurse the data, it adds the iterative rows.

  2. Use the recursive loops, it has two problems. 1st: How to get data row by row from filter_data. 2nd: How to auto end the loop in when data end in filter_table.

Please help. Thanks.

1 Like

KNIME_forum_loops.knwf (31.6 KB)

Here is the sample workflow I made, i figured it out how to end with loop with the number of rows of table.

But the main problem is that how to iterate the filter_table as well.

1 Like

Hi @nikola_tesla

Could you please post a workflow with your data ? It would help us a lot to help you :wink:

Best wishes,
Ael

1 Like

Already shared in reply.

1 Like

Thanks @nikola_tesla
Our messages crossed almost at the same time :smile:
I will have a look and come back with my thoughts :wink:
Best
Ael

1 Like

Another way around would be to avoid the loop nodes and some how use the filter_table values as an array and access the relevant indexes. But not sure how it would be achieved in Knime.

Hi @nikola_tesla

Exactly and this is somehow the idea I have implemented and shared here as a workflow:

20220601 Pikairos Help required regarding loops.knwf (70.8 KB)

Hope it helps :wink:

Best wishes
Ael

3 Likes

Thankyou very much. It solved my problem. Again thanks.

1 Like

@nikola_tesla my pleasure and thanks a lot for your kind comments.

Best wishes,
Ael

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