Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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
dakohler
New Contributor III

Re: store value of load statement in variable

tmpTable:

LOAD

item,

rate

FROM ...

WHERE item = 'coe'

;

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

DROP TABLE tmpTable;

6 Replies
kumarnatarajan
Valued Contributor

Re: store value of load statement in variable

Hi,

use peek function

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

Not applicable

Re: store value of load statement in variable

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

like this

??

Not applicable

Re: store value of load statement in variable

Hi,

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

regards

kumarnatarajan
Valued Contributor

Re: store value of load statement in variable

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

Re: store value of load statement in variable

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

dakohler
New Contributor III

Re: store value of load statement in variable

tmpTable:

LOAD

item,

rate

FROM ...

WHERE item = 'coe'

;

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

DROP TABLE tmpTable;

Community Browser