Skip to main content

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
SkyTate
Contributor
Contributor

Data loader SQL with Where in using an arrary

I would like to replace the following code in Qlik Sense Data Loader

SQL
SELECT
I_PLT,
DEPTCODE,
LINECODE,
X_LINE_DESC

from m.maslin
WHERE I_PLT in ('02462','02470','04012','04025')
with UR;

With something like this:

set vPlantsToLoad = 02462,02470,04012,04025;

SQL
SELECT
I_PLT,
DEPTCODE,
LINECODE,
X_LINE_DESC

from m.maslin
WHERE I_PLT in '$(vPlantsToLoad)'
with UR;

Labels (1)
3 Replies
rachel_delany
Creator
Creator

Your variable needs to match how you've formatted your filter in the first part.

E.g. set vPlantsToLoad = ('02462','02470','04012','04025');

SkyTate
Contributor
Contributor
Author

I had already tried that. When I do it like that I get the following error. 

 

The following error occurred:
Connector reply error: SQL##f - SqlState: 42601, ErrorCode: 4294967192, ErrorMsg: [IBM][CLI Driver][DB2] SQL0104N An unexpected token "'(''02462'',''02470'',''04012'',''04025'')'" was found following "". Expected tokens may include: "(". SQLSTATE=42601
The error occurred here:
SQL
SELECT
I_PLT,
DEPTCODE,
LINECODE,
X_LINE_DESC
 
from m.maslin
 
WHERE I_PLT in '(''02462'',''02470'',''04012'',''04025'')'
rachel_delany
Creator
Creator

Can you include the part of your script where you set the variable?