Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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.

2 Replies
Gysbert_Wassenaar

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) ;