Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
peek function
Hi,
Sorry if I miss understanding your question. Actually I don't know what you want yet. By the way you read through in help. Somthing like below
peek(fieldname [ , row [ , tablename ] ] )
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.
Examples:
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.
Regards,
Sokkorn
HI sokkorn:
If I can use peek funtion to do this question:
Material_Code | Vendor_Code |
111.03.104 | 611808 |
111.03.104 | 611809 |
111.03.105 | 611801 |
User Only want the first row group by Material Code
For example, when Material code = 111.03.104 then Vendor code = 611808, and when Material code = 111.03.105 then vendor code = 611801....
Hi,
Peek function is to pick the value from the table that we specified in that.
Peek('FieldName') picks the last value from the field that have loaded so for.
Peek('FieldName',0,'TableName') picks the first value from the specified field in the table(which is optional) given.
0-First value,1-second value and so on.
Here we cann't do group by.
For your case use
Load
Material_Code,
FirstValue(Vendor_Code) as FirstVendor
Resident
TableName Group by Material_Code;
Celambarasan
Hi Celambarasan:
Thank you for your reply so fast. And I have another question. When I create a QV "What if" Analysis, user want to save his results as version1,version2...., and can compare these versions, also want to write back the data to DB.
can Qlikview do this?
Thanks/peach