Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE

How Peek() function works - detailed explanation

0% helpful (0/1)
cancel
Showing results for 
Search instead for 
Did you mean: 
Sonja_Bauernfeind
Digital Support
Digital Support

How Peek() function works - detailed explanation

Last Update:

May 10, 2022 3:15:54 PM

Updated By:

Jamie_Gregory

Created date:

Apr 22, 2021 7:02:11 AM

The peek function uses the following syntax :

Peek( field_name [, row_no[, table_name ] ])
  • Only the field_name is mandatory.
  • row_no and table_name are optional parameters.
  • Table_name has a dependency with row_no, which means that table_name cannot be used without row_no.

Source: Peek - script function 

 

Environment

 

Resolution

 

Example:

EmployeeDates:
Load * Inline [
EmployeeCode|StartDate|EndDate
101|02/11/2010|23/06/2012
102|01/11/2011|30/11/2013
103|02/01/2012|
104|02/01/2012|31/03/2012
105|01/04/2012|31/01/2013
106|02/11/2013|
] (delimiter is '|');

 

let test = Peek('EmployeeCode',-2,'EmployeeDates') ; -> Correct, both row_no and table_name are being used at the same time
trace $(test); result = 105
let test1 = Peek('EmployeeCode') ; -> Correct, if no row is stated, -1 is assumed and if no table_name is stated, the current table is assumed.
trace $(test1); result = 106
let test2 = Peek('EmployeeCode',0) ; -> Correct, if no table_name is stated, the current table is assumed.
trace $(test2);  result = 101
let test3 = Peek('EmployeeCode','EmployeeDates') ; -> Incorrect, row_no is not being specified in this case.
trace $(test3);  result = NULL

 

Labels (1)
Version history
Last update:
‎2022-05-10 03:15 PM
Updated by: