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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Assign SQL result to script variable

Hi,

I would like to assign the result of an SQL request in a script variable:

SET var='';

SELECT CONCAT(id,';') AS idlist

FROM table;

How do I assign idlist value (for example '1;5;7;10') to var?

I tried var=idlist but get an empty result.

Thanks

Labels (1)
1 Reply
Jason_Michaelides
Partner - Master II
Partner - Master II

LOAD

     idlist

;

SQL SELECT

     CONCAT(id,';')     AS     idlist

FROM table;

LET var = Peek('idlist');

This will place the last loaded value of idlist into the variable 'var'.

Hope this helps,

Jason