Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Wildcard question

Hello,

i am looking for help for a simple wildcard issue I am over looking. I have a data table where I am trying to change the background color when a certain name string is returned.  I can't seem to figure out the correct syntax.  Here is my example:

names:

John

John Smith

John Adams

syntax:

if([field]='john*', blue())

Looking for help on step I am missing to correct.

Thank you in advance.

1 Solution

Accepted Solutions
ToniKautto
Employee
Employee

The reason in this case can be as Enrique points out, but it can also be that [field] does not equal a distinct value. A reference to a field will be calculated in the same way as a Only() call. In this case try running Only([field]) to see that it actually returns a comparable value.

I would like to suggest that you look in to using for example Wildmatch() to identify which wildcard string the compared value matches. In combination with Pick() you can then pick a specific expression to execute depending on the outcome of your WildMatch().

https://help.qlik.com/sense/en-US/online/index.html#../Subsystems/WorkingWith/Content/Scripting/Cond...

View solution in original post

6 Replies
ecolomer
Master II
Master II

is John or john (first J is capital)?

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

if(Lower([field]) like 'john*', blue())


OR


if(WildMatch(Lower([field]), 'john*'), blue())


Hope this helps you.


Regards,

jagan.

ToniKautto
Employee
Employee

The reason in this case can be as Enrique points out, but it can also be that [field] does not equal a distinct value. A reference to a field will be calculated in the same way as a Only() call. In this case try running Only([field]) to see that it actually returns a comparable value.

I would like to suggest that you look in to using for example Wildmatch() to identify which wildcard string the compared value matches. In combination with Pick() you can then pick a specific expression to execute depending on the outcome of your WildMatch().

https://help.qlik.com/sense/en-US/online/index.html#../Subsystems/WorkingWith/Content/Scripting/Cond...

ToniKautto
Employee
Employee

Just a small note. Wildmatch() is case insensitive, so you actually do not have to make the Lower() call in that scenario.

https://help.qlik.com/sense/en-US/online/index.html#../Subsystems/WorkingWith/Content/Scripting/Cond...

Anonymous
Not applicable
Author

Toni and Jagan,

thank you for the help. That solved it.

Justin

ToniKautto
Employee
Employee

I am glad to hear the issue is resolved. Please remember to mark answers as correct or helpful, so that other community members know that further assistance is not needed.