Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator III

if statement

Hi All,

I am writing the below if condition,

if(IsNull(Modality),'Null Modality',Modality),

          if(IsNull(District),'Null District',District),

               if(IsNull(Norm),'No Norm',Norm) as comment

Can you please help me bec the else condition is not passing is it because  i am closing the brace at Modality and Distrcit.

Thanks,

Bharat

1 Solution

Accepted Solutions
vvira1316
Specialist II
Specialist II

In above case statement you don't have if Modality is null then "'Null Modality" else value of field Modality and then you were checking for District and Norm in the statement to come up with Comment field like you have in original question.

Try following

If(IsNull(Modality), 'NULL Modality',

If(IsNull(District), 'NULL District',

If((IsNull(Norm) or Norm='0'), 'NO Norm', 'Include'))) as Comment

View solution in original post

18 Replies
ogautier62
Specialist II
Specialist II

may be this ?

if(IsNull(Modality),'Null Modality',Modality) & '/' &

          if(IsNull(District),'Null District',District) & '/' &

               if(IsNull(Norm),'No Norm',Norm)  as comment

bharatkishore
Creator III
Creator III
Author

Hi Olivier,

Thanks for your reply.. Can you pleas tell me what does & '/' &  do and why we need to specify..


Is it not possible to do without this..

isingh30
Specialist
Specialist

if(IsNull(Modality),'Null Modality',Modality and

          if(IsNull(District),'Null District',District and

               if(IsNull(Norm),'No Norm',Norm)))

or replace is null with Modality = 0

ogautier62
Specialist II
Specialist II

this is to concatenate in the same field comment

& concatenates two strings

so comment could be : 'Null Modality/District num/No Norm'

bharatkishore
Creator III
Creator III
Author

Sorry Ishtdeep getting error

bharatkishore
Creator III
Creator III
Author

Thank you,

But i need if first condition is not satisfied then only second condition and else

if(IsNull(Modality),'Null Modality',Modality),

          if(IsNull(District),'Null District',District)

Please let me know if you need anything more..

isingh30
Specialist
Specialist

Can you share data in excel format?

vvira1316
Specialist II
Specialist II



if( IsNull(Modality)'Null Modality'  ,    Modality)


if(condition , then , else) https://help.qlik.com/en-US/sense/April2018/Subsystems/Hub/Content/Scripting/ConditionalFunctions/if...

It will never work with the way you have written. Also not understanding what you are trying to achieve. is it in chart or script?

isingh30
Specialist
Specialist

Did you try this - or replace is null with Modality = 0??