Hi, Right Answer For ur Question
there is no function peak ?
It's an PEEK AND PICK FUNCTIONS
peek(field name [ , row [ , table name ] ] )
Returns the contents of the fieldname in the record specified by row in the internal table tablename. Data are fetched from the associative QlikView database.
Fieldname must be given as a string (e.g. a quoted literal).
Row must be an integer. 0 denotes the first record, 1 the second and so on. Negative numbers indicate order from the end of the table. -1 denotes the last record read.
If no row is stated, -1 is assumed.
Tablename is a table label, see Table Labels, without the ending colon. If no tablename is stated, the current table is assumed. If used outside the load statement or referring to another table, the tablename must be included.
peek( 'Sales' )
returns the value of Sales in the previous record read ( equivalent to previous(Sales) ).
peek( 'Sales', 2 )
returns the value of Sales from the third record read from the current internal table.
peek( 'Sales', -2 )
returns the value of Sales from the second last record read into the current internal table.
peek( 'Sales', 0, 'Tab1' )
returns the value of Sales from the first record read into the input table labeled Tab1.
Load A, B, numsum( B, peek( 'Bsum' ) ) as Bsum...;
creates an accumulation of B in Bsum.
pick(n, expr1[ , expr2,...exprN])
Returns the n:th expression in the list. n is an integer between 1 and N.
pick( N'A''B'4, , , )
returns 'B' if N = 2
returns 4 if N = 3
Peek () Function -> The Peek() function can easily reference any previously loaded row in the table using the row number in the function e.g. Peek(‘Employee Count’, 0) loads the first row. Using the minus sign references from the last row up. e.g. Peek(‘Employee Count’, -1) loads the last row. If no row is specified, the last row (-1) is assumed. The Previous() function needs to be nested in order to reference any rows other than the previous row e.g. Previous(Previous(Hires)) looks at the second to last row loaded before the current row.
Pick() Function -> Pick Function Is Useful For Pick the data vales from the data point
…will return Bolton if N=1 or it will return Smith if N=3.
Pick function. Similar logic would require a nested if function..
If(N=1, ‘Bolton’, if(N=2, ‘Underwood’, ‘Smith))
Now that you know powerful QV Pick function is, let’s explore some practical usage. I have found Pick function adding simplicity to my code when I blend it with other powerful QlikView functions such as Match or Ceil functions.
- This function returns the field value from a specific field. You can specify the row no that you want to extracts and also table.
- Syntax- Peek(fieldname, rownumber, tablename)
- rownumber must be integer & it start from 0.
- 0 means the first record in QV database
- Negative numbers means the last record in QV database. E.g. -1 will return last record.
- If row no is not specified it will take the default value i.e. -1
- If tablename is not specified, it will take the current table.
Let vMin = Date(Peek('ShipDate',0),'DD-MM-YYYY');
let vMax = Date(Peek('ShipDate',-1),'DD-MM-YYYY');
The first query will return min date & the second query will return max data.
- This function is same as that of “Index function” in excel.
- This function can be used in script/expression editor.
- Returns the nth expression or string in the list.
- First parameter checks the position and returns the appropriate expression/string
- It can be used to avoid nested if else statement
- Combination of pick and match function can be used as switch case statements
- Dynamic set analysis statement.
- Syntax- Pick(position, expression)
This function will return “MinDate” is the minimum date is selected in the list box
Peek(): Used to retrieve specific row from the field(column) from a specific position. The Fieldname should be in single quotes which is mandatory.
--> peek('Fieldname', Position, TableName)
Position 0 = Returns First record
Position -1 = Returns Last Record.
--> pick(): Returns the nth Expression in the list.
N is an integer between 1 and N.
Returns 'A' if N=1
Returns 'B' if N= 4