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: 
Panv
Contributor II
Contributor II

if match logic not working on multiple strings

Hi all,

In loadscript, I have a function in my table where i want  to compare the field "id", to multiple values, if it matches a set of values, have status as 'Live' otherwise, get status from existing status field in table. However, it is only comparing against the first value, 87 and only lists it as Live, while the remaining 4 IDs arent live.

When i load the table and look at id 1403 for example, it still says 'Testing' instead of 'Live' which according to the formula should not be the case

if(match(id, '87','1403','3082','322','518') = 1, 'Live',release_status) as release_status2,

I have also tried with wildmatch and * around the numbers but its the same result where only the row with ID 87 says live and none of the other IDs have teh appropriate release_status2 value

what am i doing wrong here?

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Match() returns the index number of the matching element. So given 

match(id, '87','1403','3082','322','518')

id = 1403 would return 2.  So the problem is with your if test. 

match(id, '87','1403','3082','322','518') = 1

would only be true for 87.  Instead use 

match(id, '87','1403','3082','322','518')  > 0

or just 

match(id, '87','1403','3082','322','518') 

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

 

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Match() returns the index number of the matching element. So given 

match(id, '87','1403','3082','322','518')

id = 1403 would return 2.  So the problem is with your if test. 

match(id, '87','1403','3082','322','518') = 1

would only be true for 87.  Instead use 

match(id, '87','1403','3082','322','518')  > 0

or just 

match(id, '87','1403','3082','322','518') 

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

 

Panv
Contributor II
Contributor II
Author

ah, perfect thank you!! I was thinking its a binary response, based on if it matches or not

>0 was able to fix ti , ty!