Hi All,
I want to write an expression rule which should generate output as "January 2016 , February 2016, March 2016,....,January 2017, February 2017,...., till current month year (i.e Mar,2019)".
Can somebody help me with this ?
Thanks in Advance
Discussion posts and replies are publicly visible
This may not be the most efficient way of doing it, but it should do the job. Set any date as local!startDate (or make it a rule input so you can pass it in to the expression), and this should return a list of month/years including the current month/year. Obviously make any changes you see fit, but this should get you 95% of the way there. Hope this helps!
load( local!startDate: date(2014, 2, 1), local!yearDiff: year(today()) - year(local!startDate), local!monthDiffTemp: local!month(today()) - month(local!startDate), local!totalMonthDiff: if( local!monthDiffTemp > 0, 12 * local!yearDiff + local!monthDiffTemp + 1, 12 * (local!yearDiff - 1) + local!monthDiffTemp + 13 ), a!forEach( items: enumerate(local!totalMonthDiff), expression: with( local!date: eomonth(local!startDate, fv!item), text(local!date, "MMMM yyyy") ) ) )