Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loading a field as a variable

Is it possible to set the value of a variable to the value of a field loaded from a qvd?

e.g.

LOAD

field1

FROM

file.qvd;

SET variable = field1;

When I do this the variable returns the text field1 as opposed to the value in field1.

1 Solution

Accepted Solutions
prieper
Master II
Master II

You need to use the PEEK-command, like

SET variable = PEEK('field1', 0, 'MyTable')


This would load the first record, you may sort the table accordingly or create a special table with MIN- or MAX-values.

HTH
Peter

View solution in original post

3 Replies
prieper
Master II
Master II

You need to use the PEEK-command, like

SET variable = PEEK('field1', 0, 'MyTable')


This would load the first record, you may sort the table accordingly or create a special table with MIN- or MAX-values.

HTH
Peter

Not applicable
Author

Thank you.

Not applicable
Author

Hi Peter,  I am using the LET variable = PEEK('field1', 0, 'MyTable') syntax for a field that has only one value and row.  For some reason it is not giving a value for the variable.  Am I missing something?