- 使用 QlikView
- 指令碼語法和圖表函數
- 指令碼和圖表運算式中的函數
- 記錄間函數
- Peek - 指令碼函數
Peek - 指令碼函數
Peek() 會針對已經載入的或存在於內部記憶體中的列,找出表格中的欄位值。列數跟表格數一樣可以指定。
Syntax:
Peek(field_name[, row_no[, table_name ] ] )
Return data type: 雙值
Arguments:
引數 | 描述 |
---|---|
field_name | 傳回值需要的欄位名稱。輸入值必須指定為字串 (例如引號中的常值)。 |
row_no |
指定所需欄位的表格中的列。可以是運算式,但是必須解析為整數。 如未指定 |
table_name | 沒有結束分號的表格標籤。如未指定 |
Limitations:
在內部表格的第一筆記錄中,此函數會傳回
範例 | 結果 | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
新增範例指令碼到您的文件中並加以執行。然後至少將結果資料行中所列的欄位新增至您文件中的工作表,以查看結果。 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 '|');
FirstEmployee: Load EmployeeCode, Peek(EmployeeCode,0) As EmpCode Resident EmployeeDates;
|
|
||||||||||||||||||||||||||||||||||||||||||
FirstEmployee: Load EmployeeCode, Peek(EmployeeCode,-2,'EmployeeDates') As EmpCode Resident EmployeeDates; |
透過將引數 table_no 指定為 'EmployeeDates',該函數會傳回表格 |
||||||||||||||||||||||||||||||||||||||||||
The Peek() function can be used to reference data that is not yet loaded. 新增範例指令碼到您的文件中並加以執行。然後至少將結果資料行中所列的欄位新增至您文件中的工作表,以查看結果。 T1: LOAD * inline [ ID, Value 1|3 1|4 1|6 3|7 3|8 2|1 2|11 5|2 5|78 5|13 ] (delimiter is '|'); T2: LOAD *, IF(ID=Peek(ID), Peek(List)&','&Value,Value) AS List RESIDENT T1 ORDER BY ID ASC; DROP TABLE T1; |
|