Selection of Certain rows from one table/node with respect to date provided in another table/node

Dear Knime experts and enthusiasts! Need some help.

Input :slightly_smiling_face:

Table 1
Date
12-03-2019
15-05-2019
19-06-2019

Table 2
Date Amount
06-03-2019 5
07-03-2019 2
08-03-2019 2
09-03-2019 6
10-03-2019 8
11-03-2019 2
12-03-2019 4
09-05-2019 6
10-05-2019 5
11-05-2019 6
12-05-2019 9
13-05-2019 2
14-05-2019 1
15-05-2019 4
13-06-2019 6
14-06-2019 3
15-06-2019 7
16-06-2019 1
17-06-2019 7
18-06-2019 9
19-06-2019 6

Output required:

Please give last five dates of table 2 with respect to row provided in table 1.

It would look like

12-03-2019 06-03-2019 5
07-03-2019 2
08-03-2019 2
09-03-2019 6
10-03-2019 8
11-03-2019 2
15-05-2019 10-05-2019 5
11-05-2019 6
12-05-2019 9
13-05-2019 2
14-05-2019 1
19-06-2019 14-06-2019 3
15-06-2019 7
16-06-2019 1
17-06-2019 7
18-06-2019 9

Please suggest node and workflow ASAP.

Regards,
Ravi

edited: by mistake in 12-03-2019 reference six rows has been taken (i.i. ignore 12-03-2019 = 06-03-2019 amount 5

Hi @ravi13

Take a look a this joining_dates_creating_tables.knwf (59.9 KB) .


gr. Hans

1 Like

Thank you so much.
It’s seems you have tried hard, but the output I required is not matching,
I want only last 5 dates transaction, here you have sorted as per required date, where every row is coming.
Can we use Date & Time difference or Date & Time shift… etc
Please do suggest.

hi @ravi13,

a little bit harsh, just my 2 cents.

I cannot revise the workflow from @HansS, however I would suggest a day offset calculation and then match the amounts. Please find the workflow attached…
Z_021_dates.knwf (17.4 KB)

image

hope this helps, Tommy

2 Likes

Thank you So So So much… I got the required answer.

Regards,
Ravi

Hi there!

I would go with loop with Date&Time-based Row Filter node.

Date&TimeFilter

You can use -5d as duration for End if you have consecutive dates. If not use duration which will assure you will have 5 inputs and later filter with Row Filter.

Here is wf example:
Z_021_dates_ipazin.knwf (49.5 KB)

Br,
Ivan

3 Likes

Thanks , that’s something new I learned todays.
Thanks again for quick response.

2 Likes

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