Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Talk to Experts, a LIVE Q&A Webinar. Bring your Qlik Sense Business questions on Aug. 4th. Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator III
Creator III

uses of case in qliksense script

Hi All,

How to write case statement in qliksense - as I got multiple option 

if (CLAIM_STATUS - 

Await third party approach

Claim Authorized

Creating

In progress%

THEN 'OPEN')

if (CLAIM_STATUS -

Incorrectly Registered

Not taken up

Not Taken Up – Dormant

Rejected - File Closed

THEN 'CLOSED' )

if(CLAIM_STATUS-

Approval Declined

Finalised - No Cover

Finalised – Repudiated

THEN 'Repudiated' )

 

Please kindly help me to write the script load in Qliksense . There are three condition.

Thanks in Advance

1 Solution

Accepted Solutions
Highlighted
Creator II
Creator II

Re: uses of case in qliksense script

Try a nested if statement

if(CLAIM_STATUS = 'Await third party approach' or 
CLAIM_STATUS='Claim Authorized' or
CLAIM_STATUS='Creating' or
CLAIM_STATUS='
In progress%',  'OPEN',
if(CLAIM_STATUS='Incorrectly Registered' or
CLAIM_STATUS='Not taken up' or
CLAIM_STATUS='
Not Taken Up – Dormant' or
CLAIM_STATUS='
Rejected - File Closed', 'CLOSED',
if(CLAIM_STATUS='Approval Declined' or
CLAIM_STATUS='Finalised - No Cover' or
CLAIM_STATUS='
Finalised – Repudiated', 'Repudiated', 'Unknown Status'))) as NewFieldName

View solution in original post

6 Replies
Highlighted
Master
Master

Re: uses of case in qliksense script

Hi

Are you talking about upper and lower case? Then you can use Upper()

If you are talking about case ( SQL), use Pick(Match())

Highlighted
Creator II
Creator II

Re: uses of case in qliksense script

Try a nested if statement

if(CLAIM_STATUS = 'Await third party approach' or 
CLAIM_STATUS='Claim Authorized' or
CLAIM_STATUS='Creating' or
CLAIM_STATUS='
In progress%',  'OPEN',
if(CLAIM_STATUS='Incorrectly Registered' or
CLAIM_STATUS='Not taken up' or
CLAIM_STATUS='
Not Taken Up – Dormant' or
CLAIM_STATUS='
Rejected - File Closed', 'CLOSED',
if(CLAIM_STATUS='Approval Declined' or
CLAIM_STATUS='Finalised - No Cover' or
CLAIM_STATUS='
Finalised – Repudiated', 'Repudiated', 'Unknown Status'))) as NewFieldName

View solution in original post

Highlighted
Creator III
Creator III

Re: uses of case in qliksense script

Sorry for misleading.

IF( CLAIM_STATUS = 'Await third party approach'
or CLAIM_STATUS='Claim Authorized'
or CLAIM_STATUS='Creating', 'Open')
ELSE IF (CLAIM_STATUS ='Incorrectly Registered'
or CLAIM_STATUS='Not taken up'
or CLAIM_STATUS='Not Taken Up – Dormant' THEN 'CLOSED' )

ELSE IF (CLAIM_STATUS ='Approval Declined'
or CLAIM_STATUS='Finalised - No Cover'
or CLAIM_STATUS='Finalised – Repudiated' THEN 'Repudiated' ) AS "CLAIM_STATUS_FINAL

something like this , three condtion in one statement in script load . I saw case statement cannot be used. Please kindly assist with the script load.
Highlighted
Master
Master

Re: uses of case in qliksense script

Can you try this?

IF( CLAIM_STATUS = 'Await third party approach'or CLAIM_STATUS='Claim Authorized'or CLAIM_STATUS='Creating', 'Open'),IF (CLAIM_STATUS ='Incorrectly Registered'
or CLAIM_STATUS='Not taken up'
or CLAIM_STATUS='Not Taken Up – Dormant' ,'CLOSED' ), IF (CLAIM_STATUS ='Approval Declined'
or CLAIM_STATUS='Finalised - No Cover'
or CLAIM_STATUS='Finalised – Repudiated' , 'Repudiated' ))) AS CLAIM_STATUS_FINAL;

Highlighted
Creator II
Creator II

Re: uses of case in qliksense script

Did you try my suggested script?

It should have three conditions as you require.  The else clause is the following if statement, with the exception of the last one which is a catchall for unexpected values.

Highlighted
Specialist
Specialist

Re: uses of case in qliksense script

I would suggest using Applymap in this case in qlik script.