Hi,
I have a date range created using two Date variables called, varBonusEndDate and varBonusStartDate.
I'm wondering how do I put that range into a collection a single date entries?
I have a range of 5 days for example, the varBonusStartDate = 2/7/2022 and varBonusEndDate = 2/11/2022.
I would like the collection to have one column called colDate and have 5 records in that collection to correspond to the range:
1. 2/7/2022
2. 2/8/2022, etc
Appreciate your help!
Thanks
Solved! Go to Solution.
That was dependent on if you needed start and end to be included. If you want it included, then change the formula to:
Collect(yourCollection,
ForAll(Sequence(DateDiff(varBonusStartDate, varBonusEndDate, Days) + 1, 0),
{colDate: DateAdd(varBonusStartDate, Value, Days)}
)
)
Your formula would be:
Collect(yourCollection,
ForAll(Sequence(DateDiff(varBonusStartDate, varBonusEndDate, Days), 0),
{colDate: DateAdd(varBonusStartDate, Value, Days)}
)
)
I hope this is helpful for you.
Thank you @RandyHayes for your quick response. This works, except the last entry is not put into the collection. The collection contains the first four dates. I also created a gallery to confirm and there are only 4 dates in the collection.
That was dependent on if you needed start and end to be included. If you want it included, then change the formula to:
Collect(yourCollection,
ForAll(Sequence(DateDiff(varBonusStartDate, varBonusEndDate, Days) + 1, 0),
{colDate: DateAdd(varBonusStartDate, Value, Days)}
)
)
Thanks you too! (actually now evening for me 😁 )
Hi Randy,
Where are we supposed to write this code?
User | Count |
---|---|
256 | |
111 | |
95 | |
48 | |
40 |