One approach would be to sort the working days data by employee (employee ID) and date. You can then process each employee's data as a group in the transform node using the node's 'GroupBy' property to indicate which field defines the group a record is associated with.
You can then for each employee day record inspect the field that indicates whether the employee worked on a day. If they did, add the required output fields into an array (list) and add the array as an element in a nested array for the current sequence of worked days. If the employee did not work on the day being processed, the record effectively indicates the end of the current sequence of worked days. If you have accumulated more than 13 records in the nested array then the array will contain all of the records for that sequence of work days, so output the individual day records and then clear the contents of the nested array.
The attached zip file contains an example data flow that implements the above logic. Data360 Analyze v.3.14 is required to import the data flow.
The debug fields can be uncommented if you want to inspect how all of the records are being processed. I would suggest only using a moderate number of input records in this case as multiple records are output for each input record.
------------------------------
Adrian Williams
Precisely Software Inc.
------------------------------
Original Message:
Sent: 07-18-2024 09:40
From: Sarita Gerbig
Subject: Consecutive Days Worked
Given a rolling 180 days from today, I am trying to create python code that will output employees and the dates after having worked 13 consecutive calendar days in a row - no day off. I would appreciate any help to get me there.
------------------------------
Sarita Gerbig
Consultant, Internal Audit
Windstream Communications
------------------------------