Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
mwallman
Creator III
Creator III

What is a better way to write IF expressions with an ELSE?

Hi,

I am aware that Pick Match can be a better way of writing an IF expression.

However, what is a better way to write an IF expression if the expression has an ELSE in the code too?

3 Replies
sunny_talwar

What is the expression? You can write Pick(Match()) in case of else as well....

JustinDallas
Specialist III
Specialist III

You're probably going to want to be more specific about your use case.  If/Else can be substituted for things like Match, and multiple ApplyMaps depending on how exotic you want to get.

marcus_sommer

One way could be to wrap a pick(match()) within an if-loop to fetch the else-part or if your results are only numeric you could use alt(pick(match()), ElsePart).

Another possibility might be to use an else-part within the pick(match()) maybe in this way:

pick(wildmatch(Field, 'a', 'b', '*'), 'a', 'b', 'else')

- Marcus