Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
I have a field it includes number and string text such as 1234 abcd,4321 desf
I want to use wildmatch function in order to get numbers
My code example is
if(WildMatch(Field,'*300914*','*120001031*')=1,'good','bad') but this code is working only for ' 300914'
it doesn not work both situation (300914 and 120001031)
Try: if(WildMatch(Field,'*300914*','*120001031*'),'good','bad')
Wildmatch returns 1 if it matches 300914 and returns 2 if it matches 120001031
WildMatch (and any variant of Match) returns the position on which the result was matched. So in your case for 120001031 it returns 2.
If you want to use it for true/false comparisons, always use Match(...)<>0 or just simply Match() with no comparison operator (everything but 0 and null is treated as True).
You will have to split the expression using an or statement. Try something like...
if(WildMatch(Field,'*300914*')=1 or WildMatch(Field,'*120001031*')=1,'good','bad')
But that will only work for those two numbers. If this is not what you want please be clearer..
M
HI
Try nested if condition as follows
If(WildMatch(Field,'*300914*')=1),'good',If(WildMatch(Field,'*120001031*')=1),'bad')
Regards
Revathy
Could also do:
pick(wildmatch(Field,'*300914*','*120001031*'),'good','bad'))
Please try using greater than equal (>=) instead of just equal (=):
if(WildMatch(Field,'*300914*','*120001031*')>=1,'good','bad')
I'm going to bump this - did you find a resolution? Unfortunately none of the suggestions have worked for me.
I have the same issue - wanting to find the number of clients who have both these products, (example) 'Car' & 'Boat'. Not one or the other - both.
I have as the wildmatch - if (WildMatch(Product, '*Car*','*Boat*')=1,'Combo',null), with the measure count(Client ID), and with the option of showing null values unchecked.
I have the problem that it's only returning the number of clients with Cars, not the number of clients with both a Car and a Boat.
In other words, say there's a 100 clients with Cars, and another 80 with Boats, and 50 have both a Car and a Boat, it's returning 100, not 50.
If I change it to '=2' it returns the number of boats, 80. And if I leave out the =1 or 2 altogether, it brings back the combined total, so 180.
I am using Qlik Sense Server, but the SQL theory/syntax should be the same.
Any help appreciated please.
Could you try some set analysis expressions like
=count({<[ClientID] = p({<[Products] = {A}>}) * p({<[Products] = {B}>}) >} distinct [ClientID])
Hope it helps!
Thanks Kiruthi.
I'm not really sure where this fits in with either a table or a pivot table sorry.
I was using the Wildmatch as a Row Dimension in a pivot table - where would your expression fit in please? I'm relatively new to Qlik.