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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Case statement with in clause in load editor

In my load script I have

SELECT JOB_NUM, FIELD_2, FIELD_3, FIELD_4,

CASE WHEN JOB_NUM IN ('JOB_1', 'JOB_2', 'JOB_3') THEN 1 ELSE 0 END AS FLAG_1,

CASE WHEN JOB_NUM IN ('JOB_4', 'JOB_5', 'JOB_6') THEN 1 ELSE 0 END AS FLAG_2,

CASE WHEN JOB_NUM IN ('JOB_7, 'JOB_8', 'JOB_9') THEN 1 ELSE 0 END AS FLAG_3,

CASE WHEN JOB_NUM IN ('JOB_1', 'JOB_4', 'JOB_7') THEN 'MONDAY_JOBS'

           WHEN JOB_NUM IN ('JOB_2', 'JOB_5', 'JOB_8') THEN 'TUESDAY_JOBS'

           WHEN JOB_NUM IN ('JOB_3', 'JOB_6', 'JOB_9') THEN 'WEDNESDAY_JOBS'

           ELSE 0 END AS JOB_DAY

FROM JOB_CONTROL.JOB_CONTROL

I then save this as a temporary table.

This runs and works well when I comment out the red text but errors when I include the text in red.

Any ideas?

3 Replies
Nicole-Smith

It might have something to do with casting.  Does it run if you change it to the following?

CASE WHEN JOB_NUM IN ('JOB_1', 'JOB_4', 'JOB_7') THEN 'MONDAY_JOBS'

           WHEN JOB_NUM IN ('JOB_2', 'JOB_5', 'JOB_8') THEN 'TUESDAY_JOBS'

           WHEN JOB_NUM IN ('JOB_3', 'JOB_6', 'JOB_9') THEN 'WEDNESDAY_JOBS'

           ELSE CAST(0 AS VARCHAR) END AS JOB_DAY

Anonymous
Not applicable
Author

It doesn't seem to like that either! Thanks for your help though

Anonymous
Not applicable
Author

Solved by creating the column when I loaded data from the table back in instead