Dividing and splitting rows

Dear KNIMErs,

I have a dataset with tasks that have to be done, the tasks can only be done during 8 hours a day. Some tasks are larger than 8 hours so I want to split them up in rows of 8 hours. Also the targeted date has to be -1. I tried this on different ways, but I didn’t find a solution yet. It seems pretty simple to me but somehow I can’t get it done. Can somebody please help me? :slight_smile:

The data is like this:

Task | Hours | TargetDate
1234 | 16 | 02-01-2019

And has to be like this:

Task | Hours | TargetDate
1234-1 | 8 | 02-01-2019
1234-2 | 8 | 01-01-2018

Thanks in advance!

Best regards,



See attached workflow, hope it helps !

Martin K.

Dividing_Splitting_Rows.knwf (32.9 KB)

1 Like

Sir, you just made my day, thanks a lot!

It’s perfect

Now I have another problem… I splitted the tasks in subtasks like you did, but it’s now also possible a task is in the weekend or on a holiday. On those days, no one is available so I duplicated the rows again and subtracted some days in a loop. Now some days are duplicate.

Now comes a problem, further on in the model. On the same days KNIME chooses the same most efficient option. I’m using a Sort to sort on the most efficient option per notification and GroupBy node to capture the first one. Now I get a duplicate option on the same day for two splitted tasks.

So my question is: is it possible to use the GroupBy node and tell it not to use the first option if it’s already in another group?

So I want to GroupBy and aggregate on distinct options. It would be amazing if someone can help me with this :).

Thanks a lot!

I constructed a workflow that illustrates how you could do it. Basically you

  • first do it like in the example above you count down from the original TargetDay
  • the you expand the possible TargetDays by factor 3 (so you will have enough days once you start eliminating some in-between)
  • then you mark all days that are not suitable like holidays and weekends
  • the remaining ones you just join back by an iteration number and voila you have the new TargetDays

the yellow marked columns state why this day could not be used (Easter in this case). And the green column is the one with the new TargetDays

I constructed a separate workflow that extracts holidays for a given year from a website. But you could also use your own list. And for some countries you would have to decide if it is really a holiday where offices would be closed.

kn_example_extract_holidays.knwf (150.6 KB)

kn_example_split_tasks_into_days.knwf (211.2 KB)