
Digital Support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How Peek() function works - detailed explanation
Last Update:
May 10, 2022 3:15:54 PM
Updated By:
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
10,920 Views