Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a QVW wherein several objects use one of three variables either when displaying information or when calculating expressions:
1. vYear_Current
2. vYear_Previous
3. vYear_PreviousX2
I want to have these variables set to the appropriate values when data is loaded into the file. For example, if I loaded data today I would want:
vYear_Current = "2012"
vYear_Previous = "2011"
vYear_PreviousX2 = "2010"
I tried using the following in my load script but it did not work:
SET vYear_Current = YEAR(now());
SET vYear_Current = YEAR(now(-1));
SET vYear_Current = YEAR(now(-2));
Any ideas?
Thanks,
Josh
Hi Josh,
Use the following instead. LET evaluates the function, then stores into the variable. SET only stores.
LET vYear_Current = Year(Today());
LET vYear_Current = Year(Today()) -1;
LET vYear_Current = Year(Today()) -2;
Hope that helps.
Miguel
Hi Josh,
Use the following instead. LET evaluates the function, then stores into the variable. SET only stores.
LET vYear_Current = Year(Today());
LET vYear_Current = Year(Today()) -1;
LET vYear_Current = Year(Today()) -2;
Hope that helps.
Miguel
Hello, If I Want the months of this year it would be?
LET vYear_Current = Year(Month((Today())); Jun
LET vYear_Current = Year(Month(Today())) -1; May
LET vYear_Current = Year(Month(Today())) -2; Apr
Thanks,
Hi,
I'd rather use complete dates or at least, month date combination, as long as you already have a field with the same format in your calendar:
LET vCurrentMonth = MonthName(Today());
LET vPreviousMonth = MonthName(AddMonths(Today(), -1));
LET vPrePreviousMonth = MonthName(AddMonths(Today(), -2));
As mentioned, you need a field in your calendar built with MonthName.
Hope that helps.
Miguel
P.S.: Please next time open a new thread, this one was closed six months ago.