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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to set the result of Load * statement into variable.

Hello Guy!,

I am new to qlikview, I want to initialize the variable with the output of the Load * statement. The result of the load * statement is completely Json object. So I want to pass this variable into java script function I create. So Is there any way? Thanks.

1.png

7 Replies
adamdavi3s
Master
Master

let yourvariable = peek('[',0,'Temp);

Or something along those lines

aapurva09
Creator
Creator

Hi,

Try this:

Table1:

Load *,

       Field    // this should have a single value

from table;

LET Variable= peek('Field',0,'Table1');  // this will store the value from column 'Field' in 'Variable'

DROP Table Table1; //optional

Not applicable
Author

Even I load into a Variable like this, I still cannot pass into my javascript function.

Function Cov(JsonData)

{

...

}

When I call in Script

LOAD

Cov($(Variable))<<<<< in this line it convert Variable into the Data I set (eg. Cov({"name":"A"...)). Then this line make me error.

Thanks Guys, I am finding another way...

adamdavi3s
Master
Master

1- You've basically just copied my answer

2- you can clearly see the table and column names in the provided screenshot

Not applicable
Author

What I mean is, the Compiler convert my Variable into the Data I set in runtime. Then it became syntax error.

you can try in Script Editor like this,

LOAD

JavascriptFunction({"name":"A", "Value":1})

....

It will give u syntax error.

Thanks for ur reply bro.

marcus_sommer

You need to load it as string so that it looked like:

LOAD

'JavascriptFunction({"name":"A", "Value":1})' as Field

...

and if you load it from a file it should go in this direction:

Load concat(@1:n, chr(10), recno()) as Field from Source (txt, no labels);

and after that you could transfer it into variable in the way Adam suggested.

- Marcus

Not applicable
Author

Thanks Bro, I will try it