Forum Discussion
bojanvelevski
5 years agoValued Contributor
Hello @Tanmay_Sarkar,
You can use the following expression :
sl.range(36).map(x=>$.mapValues((value,key) => key == ‘date’ ? Date.parse(value).plusDays(x).toLocaleDateString({“format”:“MM/dd/yyyy”}) : value))
What it does is the following, the sl.range() function will produce an array of numbers from 0 to 35. On every (x) member of the array, it’s mapping the incoming document, where if the “key” is “date” , increment the date for (x) days, else map the field with no changes.
Best regards,
Bojan Velevski
Tanmay_Sarkar
5 years agoNew Contributor III
Hello @bojanvelevski
Hope you’re doing good. This worked. You’re a savior. I scratched my head all day thinking about this. It never occurred to me that sl.range() could be used like this.
Thanks a lot.
Regards,
Tanmay Sarkar