Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
mja_jami
New Contributor III

Nested IF in Load Scrirpt

Dear Qlik experts,

How can I write the load script so that it will populace a field 'Status' (i.e.;Flat Cancelled/ Reg Cancelled/ Active) checking two fields (cancel_date, premium) :

If cancel_date is not Blank/ Null and premium < 0; Then, Status = “Flat Cancelled” ,

If cancel_date is not Blank/ Null and premium >= 0; Then, Status = “Reg Cancelled” ,

If cancel_date is Blank/ Null; Then, Status = “Active”

Thank you very much for help.

Best regards,

Jami

Labels (4)
1 Solution

Accepted Solutions
mja_jami
New Contributor III

Re: Nested IF in Load Scrirpt

Thank you Bhargav,

I used this below and worked.

if(isnull(cancel_date) or cancel_date='' ,'Active',if(premium<0,'Flat Cancelled','Reg Cancelled')) as Status

Thanks very much.

5 Replies
bhargav_bhat
Contributor II

Re: Nested IF in Load Scrirpt

Hi Mja_jami,

Below is the required expression

if(isnull(cancel_date) or cancel_date='' ,'Active',if(premium<0,'Flat Cancelled','Reg Cancelled')) as Status

 

Regards,

Bhargav

mja_jami
New Contributor III

Re: Nested IF in Load Scrirpt

Thank you Bhargav,

I used this below and worked.

if(isnull(cancel_date) or cancel_date='' ,'Active',if(premium<0,'Flat Cancelled','Reg Cancelled')) as Status

Thanks very much.

bhargav_bhat
Contributor II

Re: Nested IF in Load Scrirpt

Hi Mja_jami,
Can you please mark it as correct if you got the solution
Regards,
Bhargav
marcos_rv_666
New Contributor II

Re: Nested IF in Load Scrirpt

Holis!!!

Try this

IF( isnull (cancel_date ) OR cancel_date = ' ' , 'Active', IF (  premium < 0 , 'Flat Cancelled', 'Reg Cancelled' )) AS Status 

 

Saludos!!!

Channa
Contributor III

Re: Nested IF in Load Scrirpt

IF( Len(Canceldate)>0 and Premium>0, ststus='Flat cancel',IF(Len(Canceldate)>0 and Premium>0, ststus='REg cancel',RedCancel'))

 

try like this

Channa