Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Emilien31
Contributor
Contributor

Manage 1 single list of values in load script

Hello experts, I'm new to QLIK. I'm building a dashboard and I have many queries for many indicators that are using the same list of values in the where conditions. I would like to be able to have this list defined in one single place and be able to call this defined list name in every where clause needed without copy pasting every value list. 

I've read many things but could not find the solution for that. 

I tried things like :

SET vGroupListSample = ('A1','A2','A3')

...

and... 

where assignment_group='$(vGroupListSample )' or assignment_group IN '$(vGroupListSample )' but it does not work or gives 0. Could you please help?

Labels (3)
1 Solution

Accepted Solutions
Or
MVP
MVP

Something like this should work fine, assuming you're passing this to an SQL query using IN.

I confirmed that this works with both A1 (returns one row) and A4 (returns no rows) querying MS-SQL.

SET vGroupListSample = ('A1','A2','A3');
SELECT * FROM (
SELECT 'A4' as Field) A
Where A.Field IN $(vGroupListSample) ;

 

View solution in original post

2 Replies
Or
MVP
MVP

Something like this should work fine, assuming you're passing this to an SQL query using IN.

I confirmed that this works with both A1 (returns one row) and A4 (returns no rows) querying MS-SQL.

SET vGroupListSample = ('A1','A2','A3');
SELECT * FROM (
SELECT 'A4' as Field) A
Where A.Field IN $(vGroupListSample) ;

 

Emilien31
Contributor
Contributor
Author

I was missing the "A".Field in the where condition and single quotes were not needed. Thanks!