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

Script Variable at SQL query

Hi.

This is my sql query in qlikview script.

Select

     code,

     type

From

     table

Where

     type in (1,2,5)

Now I don't want type to contain (1,2,5).

I want it to come from a variable.

how do i define the variable, and how do I change the query where expression.

Thank You.

Labels (1)
2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Like this:

SET vList = 1,2,5;

Select

     code,

     type

From

     table

Where

     type in ($(vList));


talk is cheap, supply exceeds demand
Not applicable
Author

Try like below:

LET vTypes = '(1,2,5)' ;

TYPE:

SQL SELECT CODE,

                     TYPE

FROM TABLE_NAME

WHERE TYPE IN $(vTypes) ;