Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
DateRange:
LOAD
MIN(OrderDate) as MinDate,
MAX(OrderDate) as MaxDate
Resident Orders;
LET vMinDate = Peek('MinDate',0,'DateRange')
returning NULL after debugging.I have checked DataRange table has got the values
The only issue I'm seeing here is that you don't have a semicolon after your Let statement.
What version of 12 are you running?
I just taught that exercise this week and I know it works on the latest version.
Have you tried using TRACE statement to see what vMinDate evaluates to?
DateRange:
LOAD
MIN(OrderDate) as MinDate,
MAX(OrderDate) as MaxDate
Resident Orders;
LET vMinDate = Peek('MinDate',0,'DateRange');
TRACE $(vMinDate);
Same situation here...I am using v12 SR3.
Error: Error in expression:
PEEK is not a valid function
Couldn't find PEEK in the function drop down list.
Are you trying to use this on the front end of the application?
No I tried them in the back end. The error message was generated because I was testing the validity of the expression.
Would you be able to share the script you have tried thus far?
QuartersMap:
MAPPING LOAD
rowno() as Month,
'Q' & Ceil (rowno()/3) as Quarter
AUTOGENERATE (12);
Temp:
Load
Date#(min([Request Date]),'YYYY-MM-DD') as minDate,
Date#(max([Request Date]),'YYYY-MM-DD') as maxDate
Resident Request;
Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));
DROP Table Temp;
TempCalendar:
LOAD
$(varMinDate) + Iterno()-1 As Num,
Date($(varMinDate) + IterNo() - 1) as TempDate
AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);
MasterCalendar:
Load
Date(TempDate,'M/D/YYYY') AS [Request Date],
num(Date(TempDate,'M/D/YYYY')) AS [ReqRequestDateNum],
week(TempDate) As Week,
Year(TempDate) As Year,
Month(TempDate) As Month,
Day(TempDate) As Day,
YeartoDate(TempDate)*-1 as CurYTDFlag,
YeartoDate(TempDate,-1)*-1 as LastYTDFlag,
inyear(TempDate, Monthstart($(varMaxDate)),-1) as RC12,
date(monthstart(TempDate), 'MMM-YYYY') as MonthYear,
ApplyMap('QuartersMap', month(TempDate), Null()) as Quarter,
Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear,
WeekDay(TempDate) as WeekDay
Resident TempCalendar
Order By TempDate ASC;
Drop Table TempCalendar;
See if this makes any difference:
Temp:
Load min(Date#([Request Date], 'YYYY-MM-DD')) as minDate,
max(Date#([Request Date],'YYYY-MM-DD')) as maxDate
Resident Request;
Notice the change of order of Date#() and Min/Max for the minDate and maxDate
It's working! Thank you!