Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
suvechha_b
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
rogerpegler
Creator II
Creator II

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
shiveshsingh
Master
Master

Hi

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

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

rogerpegler
Creator II
Creator II

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

suvechha_b
Creator III
Creator III
Author

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.
shiveshsingh
Master
Master

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;

rogerpegler
Creator II
Creator II

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.

passionate
Specialist
Specialist

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