Date Range

I have a column for start date and a column for end date for a particular employee number. Is there a way to take that range in Knime and give a list of those dates instead of the range?

For example there is a column for employee ID; a column for start date; a column for end date.
Start Date: 8/1/24
End Date: 8/3/24

Can I create a report that has multiple lines for the employee that has each day 8/1; 8/2; 8/3.

I have another report that I am merging this with and need to know if there are overlapping days.

Hi @dakoerber

The following workflow can achieve this:

For the sake of assumption, I created a dummy table whereby the dates are of type date in the format that is required later on. If it’s already of type string you can skip a later step.

image

Since the date range has to be determined per employee ID, you start with a group loop. This now only considers the dates for each employee.

Convert both dates to a variable with the corresponding node to do this. If applicable, convert them to String thereafter with a Variable Expression.

Use a Create D&T Range node to generate the desired range with an interval of P1D whereby the Starting Point and Ending Point are flow variable controlled.

This is off course set under the Flow Variables tab.

image

With a crossjoiner node you know associate the just created date range again with the employee ID that the group loop still considers.

After closing the loop you’ll up with the individual ranges for each employee

image

See WF:

Date Range.knwf (35.1 KB)

Hope this helps!

3 Likes

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