Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have created an variable in script but it is showing an script error,but i have tested the same in text object its working fing fine.
Please find the below error.
Variable : let vCurr_Month_Year = month(monthstart(max(ActivityDate-1)))&' '&(year(max(ActivityDate-1)));

Thanks..
Hi,
vMax = ?
Thanks..
You want the variable to evaluated in the script? or do you want to bring it as an expression?
Hi Naresh, I think the solution provided by tresesco should work, there is one parenthesys left:
LET vCurr_Month_Year = month(monthstart($(vMaxDate)))&' '&(year($(vMaxDate)));
Just to comment, why a month(monthstart(maxdate))?, I think it should be the same as Month(maxdate), no need for the monthstart.
Hi,
The current variable is static like it give only month(max(today()) but now we need it as dynamic so that based on the year it should be react..
Thanks..
I don't know your intent here but if you want to find out currentmonthyear
try this below code
temp_Min_Max_Dates:
LOAD
Min(YourDate) as MinDate,
Max(YourDate) as MaxDate
RESIDENT FWRSData
;
Let vMinDate = Num(Peek('MinDate', 0, 'temp_Min_Max_Dates'));
Let vMaxDate = Num(Peek('MaxDate', 0, 'temp_Min_Max_Dates'));
Drop Table temp_Min_Max_Dates;
//Current Date
Let vReportCurrentDay = 'Day($(vMaxDate))';
Let vReportCurrentMonth = 'num(Month($(vMaxDate)))';
Let vReportCurrentYear = 'Year($(vMaxDate))';
vMax=max(ActivityDate)
Hi,
Please let me know the below that variable is not working and is there any way to get this.
let vMax=MonthName(max(ActivityDate));
Thanks..
Hi naresh, tresesco explained why that can't work in the first answer... and how to solve it.
Hi,
I have used the approach but it gives only the max month but i need dynamic month based on the filter selection.
Thanks..
If the value needs to be calculated in front-end you can use this variable:
=Text(Date(Max(ActivityDate), 'MMM YYYY'))
and you can define the variable in script as:
SET vCurr_Month_Year = "Text(Date(Max(ActivityDate), 'MMM YYYY'))";