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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
mattbrain
Contributor
Contributor

SQL writing CASE WHEN ELSE statement

Am writing a QlikView load script, and am having an issue with a script.

The source of the information is direct from SQL, this is not a QVD load script.

Am trying to write something like this:

CASE WHEN [EXAMPLE] in (1,2,3,4) then 'Online'  else
CASE WHEN [EXAMPLE] in (5,6,7,8) then 'Offline' END as [ONLINE_or_OFFLINE],

Any assistance would be greatly appreciated. Thanks

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

May be try this

CASE
          WHEN EXAMPLE IN (1, 2, 3, 4) THEN 'Online'
          WHEN EXAMPLE IN (5, 6, 7, 😎 THEN 'Offline'
       END
          ONLINE_or_OFFLINE

View solution in original post

3 Replies
Anil_Babu_Samineni
MVP
MVP

This?

If(Match([EXAMPLE], '1','2','3','4'), 'Online',
f(Match([EXAMPLE], '5','6','7','8', 'Offline')) as [ONLINE_or_OFFLINE],

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar
MVP
MVP

May be try this

CASE
          WHEN EXAMPLE IN (1, 2, 3, 4) THEN 'Online'
          WHEN EXAMPLE IN (5, 6, 7, 😎 THEN 'Offline'
       END
          ONLINE_or_OFFLINE
mattbrain
Contributor
Contributor
Author

Amazing, thats working thanks. I thought there needed to be an "else" condition somewhere.

Thank you, you have saved me so much time