Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

Re: Script Variable at SQL query

Like this:

SET vList = 1,2,5;

Select

     code,

     type

From

     table

Where

     type in ($(vList));


talk is cheap, supply exceeds demand
Not applicable

Re: Script Variable at SQL query

Try like below:

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

TYPE:

SQL SELECT CODE,

                     TYPE

FROM TABLE_NAME

WHERE TYPE IN $(vTypes) ;

Community Browser