Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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) ;