Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
My ask is I have to schedule a report which will run on 16th of the month and on 1st or 2nd of next moth.
on 16th when report will run it holds data for 1 to 15 and when it executed on start of the month then it holds data for entire last month. I have tried it below way where i have set a 3 variables. But facing difficulty in writing in variable where if day is 16 then last date is 15 and in start of the month last date should be either 30/31 or 29.
1) Let vStartDate = date(floor(monthstart(addmonths(today(),-1))));
2) Let vEndDate = date(floor(monthend(addmonths(today(),-1))));
3) let vSdate = left(date(Today()),2);
Start of the month is very much clear where i can take 1st variable but need help while setting "end date" variable.
below given is the script where i am going to use these variable and need to have variable at '....' place
DayName(PTRNEFF) >= '$(vStartDate)' and DayName(PTRNEFF) <= ........
and date(date#(TRANSACTION_DATE,'YYMMDD'),'DD/MM/YYYY') >= '$(vStartDate)'
Thanks in advance.
As below, set variables in a conditional block
IF day(today())=1 THEN
//Previous Monthend
let vStartDate = MonthStart(Today(),-1);
let vEndDate = MonthEnd(Today(),-1);
ElseIF day(today())>=16 THEN
//any day after 16th then; Current month 1st to 15th
let vStartDate = MonthStart(Today());
let vEndDate = Date( MonthStart(Today())+14);
End IF