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: 
Aurél
Creator
Creator

Script question

Hello,

Instead of writing :

If(Left(MyFields,1) = '4' OR Left(MyFields,1) = '5' OR Left(MyFields,1) = '6'

how can I do it more simply/ properly?
This does not work:
Left(MyFields,1) IN ('4','5','6')

 

Thank you !

Labels (2)
1 Solution

Accepted Solutions
RafaelBarrios
Partner - Specialist
Partner - Specialist

hi @Aurél 

if you want to build a measure you could try


sum({< MyFields={"1*","2*","3*"} >} sales)

or

sum({< MyFields={"1*"}+{"2*"}+{"3*"} >} sales)

for an IF condition you could try wildmatch 

=if(wildmatch(MyFields,'1*','2*','3*'),MyFields)

 

Hope this helps.

Best,

help users find answers! Don't forget to mark a solution that worked for you & to smash the like button! 😁

View solution in original post

3 Replies
RafaelBarrios
Partner - Specialist
Partner - Specialist

hi @Aurél 

if you want to build a measure you could try


sum({< MyFields={"1*","2*","3*"} >} sales)

or

sum({< MyFields={"1*"}+{"2*"}+{"3*"} >} sales)

for an IF condition you could try wildmatch 

=if(wildmatch(MyFields,'1*','2*','3*'),MyFields)

 

Hope this helps.

Best,

help users find answers! Don't forget to mark a solution that worked for you & to smash the like button! 😁

aguirre
Creator
Creator

this is my attempt:

 

match(left(MyFields,1),4,5,6)>0;

 

 

Aurél
Creator
Creator
Author

It's not a mesure but it's a test in reload script.

 

I's OK with :

=if(wildmatch(MyFields,'1*','2*','3*'))

 

Thank you !