Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

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!

Tags (2)
1 Solution

Accepted Solutions
MVP
MVP

Re: wildcard matching within if statement

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
3 Replies
MVP
MVP

Re: wildcard matching within if statement

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
Valued Contributor

Re: wildcard matching within if statement

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

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

Not applicable

Re: wildcard matching within if statement

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

Community Browser