Create one row per hour from start end hour with a column

In a row are columns with some attributes. The row includes a column start, end with a time in HH:MM format. I want to have for each full hour one row, excluding the end hour

e.g.
Attr 1, start, end
row0: value0, 14:00, 16:00
row1: value1, 15:00, 16:00

the result should be:
Attr 1, start, end, hour
row0: value0, 14:00, 16:00, 14:00
row1: value0, 14:00, 16:00, 15:00
row2: value1, 15:00, 16:00, 15:00

Can I create this without a python node?

Hi @Axelb1971 ,

Yes it can be done without python.

Here’s one way, using your sample data:

It calcs the difference between the times, adds in additional rows, then determines an “hour offset” starting at 0 for the first row, and creates a new column based on that offset from the start hour.

There are no dates, so I don’t know what you intended to do if the start and end time crossed the midnight boundary . Likewise, I don’t know what should happen if the time isn’t exactly on the hour, but hopefully this gives some ideas that you can build on.

Creating additional rows based on time in existing rows.knwf (60.1 KB)

(nb. the initial component is just a means of copying and pasting your sample data easily into the example)

5 Likes

Many thanks for your efforts. It helps me a lot to solve my problem.

1 Like

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