Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Unable to fetch value using peek function in Qlikview 12

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

10 Replies
oscar_ortiz
Partner - Specialist
Partner - Specialist

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.

sunny_talwar

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);

Not applicable
Author

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.

sunny_talwar

Are you trying to use this on the front end of the application?

Not applicable
Author

No I tried them in the back end. The error message was generated because I was testing the validity of the expression.

sunny_talwar

Would you be able to share the script you have tried thus far?

Not applicable
Author

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;

sunny_talwar

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

Not applicable
Author

It's working! Thank you!