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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
markgraham123
Specialist
Specialist

Using Variable in Where Statement

Hello Everyone,

I'm trying to use Variable in Where statement which has multiple values.

Can someone pls look into this.

1 Solution

Accepted Solutions
sunny_talwar

Try these modifications:

Table:

LOAD * INLINE [

    FieldA

    1

    1

    2

    3

    4

];

// Create a temporary table

tmp:

NoConcatenate

Load concat(Distinct FieldA,',') as FieldA

Resident Table;

let vVar1 = peek('FieldA',0,'tmp');

// drop the temporary table

drop table tmp;

Table2:

LOAD * INLINE [

    FieldB

    1

    1

    2

    12

    13

    15

    16

    3

    4

];

2:

NoConcatenate

LOAD * Resident Table2

Where

Match(FieldB, $(vVar1));

DROP Table Table, Table2;

View solution in original post

6 Replies
sunny_talwar

Try these modifications:

Table:

LOAD * INLINE [

    FieldA

    1

    1

    2

    3

    4

];

// Create a temporary table

tmp:

NoConcatenate

Load concat(Distinct FieldA,',') as FieldA

Resident Table;

let vVar1 = peek('FieldA',0,'tmp');

// drop the temporary table

drop table tmp;

Table2:

LOAD * INLINE [

    FieldB

    1

    1

    2

    12

    13

    15

    16

    3

    4

];

2:

NoConcatenate

LOAD * Resident Table2

Where

Match(FieldB, $(vVar1));

DROP Table Table, Table2;

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try Where match(FieldB,$(vVar1));


talk is cheap, supply exceeds demand
maxgro
MVP
MVP

1.png

Table:

LOAD * INLINE [

    FieldA

    1

    1

    2

    3

    4

];

// Create a temporary table

tmp:

NoConcatenate

Load concat(Distinct FieldA,',') as FieldA

Resident Table;

let vVar1 = peek('FieldA',0,'tmp');

// drop the temporary table

drop table tmp;

Table2:

LOAD * INLINE [

    FieldB

    1

    1

    2

    12

    13

    15

    16

    3

    4

];

Table3:

NoConcatenate LOAD * Resident Table2

Where

match(FieldB, $(vVar1));

DROP Table Table2;

markgraham123
Specialist
Specialist
Author

Thanks a lot Sunny!

markgraham123
Specialist
Specialist
Author

Thanks Gysbert

It worked.

markgraham123
Specialist
Specialist
Author

Thanks M G.