Add data row based on date check

Hi, I have a datatable dt and based on some date conditions I need to add the rows with updated values to a new datatable.

Input dt:
image

Output dt:
image

The input table had 2nd row in which start date is exactly 7 days ahead so update the end date of previous row to the end date of 2nd row and add it to the new datatable and remove the 2nd row and go ahead with the check for the next rows.

It can also happen that all 4 rows are 7 days ahead with respect the consecutive previous rows so in this case only the first row would be added to the new dt but the End date would be the value from the 4th row.

HI,

How about the following sample?

Sample
Sample20240610-2.zip (10.6 KB)

1 Like

Thanks Yoichi. This is a great solution.

1 Like

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