Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

WildMatch not working

Hi,

The following expression works:

=WildMatch(OSUser(), '*abc') // this returns me -1 which is true

But when I try using the following expression, where UserPermitted has values *abc,*edf,*yfy. The expression below does not work

=WildMatch(OSUser(), (Concat(DISTINCT chr(39)&'*' & [UserPermitted]&chr(39) , ', '))) // this returns me 0, although it should return me -1

Please suggest!

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

It returns 3 because it matches the 3rd value.  Why do you want it to return 1?

-Rob

View solution in original post

7 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

WildMatch() cannot use a dynamic computed list in this fashion. You must use DSE to syntax to cause the parameter list to be built before the WildMatch() is evaluated. Try:

=WildMatch(OSUser(), $(=(Concat(DISTINCT chr(39)&'*' & [UserPermitted]&chr(39) , ', '))))


-Rob

http://masterssummit.com

http://qlikviewcookbook.com

Not applicable
Author

Thank you for the response. It returns me a value of 3, but it should ideally return 1.

Note:The field UserPermitted has 3 values in it.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

It returns 3 because it matches the 3rd value.  Why do you want it to return 1?

-Rob

Anil_Babu_Samineni

Would you share few values and then use expression then see

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

May be this

SubStringCount('|' & Concat(DISTINCT UserPermitted, '|,|') & '|', '|' & SubField(OSUser(), '\', -1) & '|')

Not applicable
Author

I was under the conception that the function would just return 1. Thanks for the clarification

Not applicable
Author

Thanks Sunny, this also works and is a correct answer. Wanted to mark your answer as correct too. But this website would not let me do it.

/**** This is also a correct answer ****/