Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

jtanguay
New Contributor III

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.

Tags (1)
1 Solution

Accepted Solutions
Employee
Employee

Re: Wildcard question

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...

6 Replies
ecolomer
Honored Contributor II

Re: Wildcard question

is John or john (first J is capital)?

MVP
MVP

Re: Wildcard question

Hi,

Try like this

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


OR


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


Hope this helps you.


Regards,

jagan.

Employee
Employee

Re: Wildcard question

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...

Employee
Employee

Re: Wildcard question

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...

jtanguay
New Contributor III

Re: Wildcard question

Toni and Jagan,

thank you for the help. That solved it.

Justin

Employee
Employee

Re: Wildcard question

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.