Skip to Content
Jan 29, 2021 at 02:59 PM

Generate Sequence Number based on Start Date

238 Views Last edit Jan 29, 2021 at 04:15 PM 2 rev

Good day.

I have a requirement where I am creating an iflow to generate csv file based on data received. Example:

One of the fields that I need to populate, called Sequence Number, should be determined based on the dates received..

What this means is, I can have multiple rows of data that have a start date i.e. Row 1: 22 Feb, Row 2: 21 Feb, Row 3: 20 Feb. Now based on these three dates located in different rows, the Segment Number of each row needs to reflect as Row 3: Sequence number = 1, Row 2: Sequence Number = 2, Row 1= Sequence Number = 3.

I have attached an image below of a sample CSV to show what I am trying to accomplish.

If anyone has an idea for the Groovy script to achieve this, it will be greatly appreciated.



csv.png (11.1 kB)
csv1.png (9.9 kB)