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: 
rmadursk
Contributor III
Contributor III

Conditional (If) not working as expected comparing strings.

I have a gauge I'm building, and I want it to display the number of WIndows OS in a table with multiple types of OS in it.

If I put the values in a Table Chart. I get this:

rmadursk_0-1702580177424.png

so my Wildmatch syntax ( =wildmatch(os, '*Wind*') ) returns true as expected for Windows.

When I put this into my Guage as an if statement it doesn't equate to true.

rmadursk_1-1702580381285.png

 

the syntax I'm using at the moment is =if(wildmatch(os, '*Wind*'), 10, 20). Seems like this should display 10, not 20. What fundamental thing am I missing here?

Labels (2)
1 Solution

Accepted Solutions
rubenmarin

Hi, when you have a dimension each table row is checked agains the dimension value on that row, when setting the expression in a gaude, with differnt values for os, os will be null().

Maybe with: =if(wildmatch(Concat(distinct os,';'), '*Wind*'), 10, 20)

View solution in original post

6 Replies
rubenmarin

Hi, when you have a dimension each table row is checked agains the dimension value on that row, when setting the expression in a gaude, with differnt values for os, os will be null().

Maybe with: =if(wildmatch(Concat(distinct os,';'), '*Wind*'), 10, 20)

rmadursk
Contributor III
Contributor III
Author

Worked like a champ, thank you.  Any pointers on some documentation (or just search terms) for that behavior would be appreciated.  

rubenmarin

Hi, in general, if you ask for a field and that field has different values, it returns null, so different values needs to be in an aggregation function to return a unique value to compare. Aggregation funcions could be: Sum(), Avg(), Maxstring(), Concat()... something that expects different values and does an operation with all of them to return a unique value.

https://help.qlik.com/en-US/qlikview/May2023/Subsystems/Client/Content/QV_QlikView/Scripting/Aggrega...

rmadursk
Contributor III
Contributor III
Author

Perfect. Thanks again.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Another good explanation of the need to use an aggregation function is https://community.qlik.com/t5/Design/Use-Aggregation-Functions/ba-p/1475833

-Rob

rmadursk
Contributor III
Contributor III
Author

That one's going in my favorites list.

Thanks

Ron