Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
cbaqir
Specialist II
Specialist II

Wildmatch and Multiple If Statements

This works: if(wildmatch(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*' )>0, 'Provider', 'Non-Provider') as PROVIDER,

But this doesn't:

dual( if(wildmatch(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*' )>0, 'Provider'),
if(wildmatch(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*' )>0 and if(match(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*' )>0, 'Both'),
'Non-Provider'))
as PROVIDER,

What is wrong with my syntax?

1 Solution

Accepted Solutions
sunny_talwar

If your list within GOV_DECISION_BODY is separated by comma's (or similar character), you can try this

Table:

LOAD *,

If(WildMatch(GOV_DECISION_BODY, '*ECG*')+WildMatch(GOV_DECISION_BODY,'*CCG*')+WildMatch(GOV_DECISION_BODY, '*PCG*') = SubStringCount(GOV_DECISION_BODY, ',') + 1, 'Provider',

If(WildMatch(GOV_DECISION_BODY, '*ECG*')+WildMatch(GOV_DECISION_BODY,'*CCG*')+WildMatch(GOV_DECISION_BODY, '*PCG*') < SubStringCount(GOV_DECISION_BODY, ',') + 1 and

WildMatch(GOV_DECISION_BODY, '*ECG*')+WildMatch(GOV_DECISION_BODY,'*CCG*')+WildMatch(GOV_DECISION_BODY, '*PCG*') >= 1, 'Both', 'Non-Provider')) as PROVIDER;

LOAD * INLINE [

    GOV_DECISION_BODY

    "ECG, PCG"

    "ECG, ABC"

    "ABC, DEF"

];

Capture.PNG

View solution in original post

9 Replies
antoniotiman
Master III
Master III

May be

dual( if(wildmatch(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*' )>0, 'Provider'),
if(wildmatch(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*' )>0 and match(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*' )>0, 'Both'),
'Non-Provider')) as PROVIDER
,

Remove If( from  If(match(GOV.....

sunny_talwar

What is this doing?

dual( if(wildmatch(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*' )>0, 'Provider'),
if(wildmatch(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*' )>0 and if(match(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*' )>0, 'Both'),
'Non-Provider')) as PROVIDER,

Check for exact match? Then why use * in the check part?

its_anandrjs

What if you use only this way why dual required here.

      if(wildmatch(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*' ) > 0, 'Provider',

      if(wildmatch(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*' ) > 0 and

      if(match(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*') > 0,'Both'),'Non-Provider'))  as PROVIDER,

cbaqir
Specialist II
Specialist II
Author

The GOV_DECISION_BODY field has multiple values. I need to have Provider = Both if there is a value = '*ECG*','*PCG*','*CCG*' and one that doesn't match.

sunny_talwar

May be this

If(WildMatch(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*') > 0,

If(NOT WildMatch(GOV_DECISION_BODY, '*ECG*','*PCG*','*CCG*') > 0, 'Both', Provider'), 'Non-Provider') as PROVIDER

If this works, we can move to Dual part

cbaqir
Specialist II
Specialist II
Author

This doesn't seem to be working. I see provider and -.

cbaqir
Specialist II
Specialist II
Author

It's flagging an extra ")" somewhere.

sunny_talwar

I guess they are contradicting statements.... this will not work... testing right now

sunny_talwar

If your list within GOV_DECISION_BODY is separated by comma's (or similar character), you can try this

Table:

LOAD *,

If(WildMatch(GOV_DECISION_BODY, '*ECG*')+WildMatch(GOV_DECISION_BODY,'*CCG*')+WildMatch(GOV_DECISION_BODY, '*PCG*') = SubStringCount(GOV_DECISION_BODY, ',') + 1, 'Provider',

If(WildMatch(GOV_DECISION_BODY, '*ECG*')+WildMatch(GOV_DECISION_BODY,'*CCG*')+WildMatch(GOV_DECISION_BODY, '*PCG*') < SubStringCount(GOV_DECISION_BODY, ',') + 1 and

WildMatch(GOV_DECISION_BODY, '*ECG*')+WildMatch(GOV_DECISION_BODY,'*CCG*')+WildMatch(GOV_DECISION_BODY, '*PCG*') >= 1, 'Both', 'Non-Provider')) as PROVIDER;

LOAD * INLINE [

    GOV_DECISION_BODY

    "ECG, PCG"

    "ECG, ABC"

    "ABC, DEF"

];

Capture.PNG