Date handling in multiple records

0
In a Microflow I insert a number of records based on sourcerecords. In every sourcerecord I have a Duration and a TimeLag, both in minutes. The last record to be created should end at a specific time, say 17:00. The first record should get end-time 17:00 and start-time 17:00 -/- Duration of the corresponding sourcerecord.. The second record should get the end-time of the first record -/- TimeLag of the second sourcerecord. It should get start-time as end-time -/- Duration of the sourcerecord. And so on. How?
asked
1 answers
0

The simplest way to do this is to use the addMinutes($date, Nr) functionality. Note that the number of minutes to add can be a negative number, so starting from your end date, you can 'add' the negative duration to get the start date.

So if you retrieve your source records sorted in reverse order, you can start with the last record, work out its start time, then use this as the end time for the next record and repeat through the loop.

answered