Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
NavinReddy
Creator II
Creator II

If condition is not working

Hi All,

below if condition is not working for me, kindly please suggest. 

if(Match(trim([Product Code]),'3')and [Product Code]='3', 'text', 'text1')

Thanks,

NR

Labels (4)
3 Replies
vchuprina
Specialist
Specialist

Hi,

Trim function removes spaces near value, so I assume that you have spaces, for instance

' 3' or ' 3 '

In this case, the first part of your expression returns true because trim removes spaces and you get '3'

Match(trim([Product Code]),'3')

But the second part returns false because the Product Code value still contains spaces

[Product Code]='3',

You can just replace your condition by following:

if(trim([Product Code]) = '3', 'text', 'text1')

Regards,

Vitalii

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
NavinReddy
Creator II
Creator II
Author

Hi Vitalli,

Thanks for your quick response, i tried with option but still not working. any other set analysis/other options. 

if([Product Code]='3' or Match(trim([Product Code]),'3'),'text','text1')

Regards,

NR

vchuprina
Specialist
Specialist

Could you please share your result? I don't understand where you try to use this condition in the UI or in the script part.

Regards,

Vitalii

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").