Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

wildcard matching within if statement

Hi everyone,

today, Im having simple problem that is driving me crazy!

All I want to do is to evaluate if supplyed text matches an expression and then do something:

Let maskedCount = 1;

LET name = 'BRR_wrwq';

if Match($(name), '*BRR_*') then

  let maskedCount = $(maskedCount) + 1;

ENDIF

I have tried all of if and *Match functions in perhaps all combinations possible but its doing just what it wants 😕

In this particular case Im referring to wildmatch function

It still skips the let statement and if I add <>0 it allways enters it

Im using QlikView 11 SR1 64bit

Thank for your responses!

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This should work:

Let name = 'BRR_wrwq';

If WildMatch('$(name)', '*BRR_*') then

  Let maskedCount = maskedCount + 1;

End If

or

Let name = 'BRR_wrwq';

Let maskedCount = maskedCount + If(WildMatch('$(name)', '*BRR_*'), 1, 0);

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This should work:

Let name = 'BRR_wrwq';

If WildMatch('$(name)', '*BRR_*') then

  Let maskedCount = maskedCount + 1;

End If

or

Let name = 'BRR_wrwq';

Let maskedCount = maskedCount + If(WildMatch('$(name)', '*BRR_*'), 1, 0);

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
juleshartley
Specialist
Specialist

You need to enclose the variable in apostrophes, and use 'wildmatch'

...if wildmatch('$(name)','*BRR_*') then ...

Not applicable
Author

both you solutions are working, thank you very much!
Mystery solved!