Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Welcome to our newly redesigned Qlik Community! Read our blog to learn about all the new updates: READ BLOG and REPORTED ISSUES
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor
Contributor

Multiple if else on field load script qliksense

Hi All,

I have requirement to create custom field load script in qlik sense with conditions like 

(if field like 'Power* ( if field1 is null , then field2+field3 else field 1 ))

 

how to achieve it

 

 

Labels (3)
4 Replies
Partner
Partner

the format is if(condition , then , else)

not compactly clear on the logic you need but hopefully below can give you a start

load field,field1,.................

if(wildmatch(field,'Power*')=1,

      ,   if(isnull(field1),field2+field3 , field 1 )

     , else_condition_to_like_power) as NewColumnName

 

you can either put in the simple load statement or as a preceding load

 

https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/ConditionalFun...

Contributor
Contributor

The logic is like

If(Field like 'Power' and field1 is null then PM+field3)

else if(Field like 'File' and field1 is null then field2+field3

else if (Field like 'Sys' then field2+field3)

how to achieve this in Qlik sense load script

Partner
Partner

something like below

If(wildmatch(field,'Power*')=1 and isnull(field1) , PM+field3,

                 if(wildmatch(field,'file*')=1 and isnull(field1), field2+field3,

                 if (wildmatch(field,'Sys*')=1, field2+field3)))

Partner
Partner

mark as answered if the answers helped