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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

store value of load statement in variable

hi all,

i want to store value of load statement in a variable. is it possible?

i have a excel file with values below:

item     rate

coe     0.23

cog     0.50

i want to store in a variable like below:

let rate= load rate from excelfile where item='coe';

and rate variable should give value as 0.23

please advise with right steps

thanks

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

tmpTable:

LOAD

item,

rate

FROM ...

WHERE item = 'coe'

;

LET vRate = PEEK('rate',-1,'tmpTable')

DROP TABLE tmpTable;

View solution in original post

6 Replies
kumarnatarajan
Partner - Specialist
Partner - Specialist

Hi,

use peek function

EX: let rate=peek( 'FieldName', 0, 'TableName' )

Not applicable
Author

let rate = peek(load rate from excelfile where item='coe');

like this

??

Not applicable
Author

Hi,

you can assign lookup function value as your variable value. Take a look into definition of lookup function in Reference Manual.

regards

kumarnatarajan
Partner - Specialist
Partner - Specialist

Hi,

First read in peek function in help. See the below syntex.(Single quotes must)

EX: let rate=peek( 'FieldName', 0, 'TableName' )

FieldName = Finding field name

TableName= Finding table name

Not applicable
Author

Hi,

   Please correct me .

You wanted to maintain  Data in Excel and from that you need to fetch particular row with the some conidition and then you want to assign it to Varaible .

What i can suggest is that you can maitain the Variable directly in the Excel sheet .

So if you want to change value you can cahnge in the Excel itself instead of changing the value in thescript .

Regards

Yusuf

Anonymous
Not applicable
Author

tmpTable:

LOAD

item,

rate

FROM ...

WHERE item = 'coe'

;

LET vRate = PEEK('rate',-1,'tmpTable')

DROP TABLE tmpTable;