Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
raadwiptec
Creator II
Creator II

wildmatch

hi all,

is their a way to have multiple conditions in wildmatch

for ex: the data as below

Load * Inline[

account,

transtype,

transmovement

amount

]

for the above table i would like to group as following

if(WildMatch(transtype,'*101','*102','*103','*104'),'N-P customer ',

if(WildMatch(transtype,'*99','*98'),'N-P-N customer ',

if(WildMatch(transtype,'*89'),'Unknown customer ', - here need an additional condition --saying that transtype should be 89 starting with and transmovement is 500 and 511

)) as Customer Group

any suggestions

1 Solution

Accepted Solutions
sunny_talwar

May be this:

If(WildMatch(transtype,'*101','*102','*103','*104'),'N-P customer ',

If(WildMatch(transtype,'*99','*98'),'N-P-N customer ',

If(WildMatch(transtype,'*89') and Match(transmovement, 500, 511),'Unknown customer ')) as Customer Group

View solution in original post

8 Replies
sunny_talwar

May be this:

If(WildMatch(transtype,'*101','*102','*103','*104'),'N-P customer ',

If(WildMatch(transtype,'*99','*98'),'N-P-N customer ',

If(WildMatch(transtype,'*89') and Match(transmovement, 500, 511),'Unknown customer ')) as Customer Group

raadwiptec
Creator II
Creator II
Author

Hi sunny ,

there is a small chnage.

if(WildMatch(transtype,'*101','*102','*103','*104'),'N-P customer ',

if(WildMatch(transtype,'*99','*98'),'N-P-N customer ',

if(WildMatch(transtype,'*89'),'Unknown customer ',Others' - So here for rest of  the transtype starting with and transmovement should be 500 and 511

)) as Customer Group

sunny_talwar

transtype starting with??

raadwiptec
Creator II
Creator II
Author

it is rest of the others .. there are more than 60-70 transtype codes..but should limit to transmovement be 500 and 511


that is the reason i have put 'others' after


if(WildMatch(transtype,'*89'),'Unknown customer ',Others'

sunny_talwar

May be this:

If(WildMatch(transtype,'*101','*102','*103','*104'),'N-P customer ',

If(WildMatch(transtype,'*99','*98'),'N-P-N customer ',

If(WildMatch(transtype,'*89'), 'Unknown customer',

If(Match(transmovement, 500, 511), 'Others')))) as Customer Group

swuehl
MVP
MVP

I think above is the logic you required.

But keep in mind that there might be records for which this expression will return NULL, i.e. records with unspecified [Customer Group].

Just wondering if this is what you want, given the fact that you already have to classses 'unknown customer' and 'Others', so I would expect to use one value to catch everything else, so selecting all classes from [Customer Group] won't remove records.

If(WildMatch(transtype,'*101','*102','*103','*104'),'N-P customer ',

If(WildMatch(transtype,'*99','*98'),'N-P-N customer ',

If(WildMatch(transtype,'*89'), 'Unknown customer',

If(Match(transmovement, 500, 511), 'Others','N/A')))) as [Customer Group]

But maybe that's not required here...

raadwiptec
Creator II
Creator II
Author

Hi Both,

It gives output few data.. but Iam waiting from the customer feedback whether the data and calculations  are correct or not .

If(WildMatch(transtype,'*101','*102','*103','*104'),'N-P customer ',

If(WildMatch(transtype,'*99','*98'),'N-P-N customer ',

If(WildMatch(transtype,'*89'), 'Unknown customer',

If(Match(transmovement, 500, 511), 'Others')))) as Customer Group


can you also tell me how to make wildmatch again based on this output


for ex:

f(WildMatch([Customer Group],'*N-P '),'Customers ',

If(WildMatch([Customer Group],'*Unk '),'Unidentified

))) as Customer main Group


i tried to add this in a new resident load statement .but i dont get any values.



sunny_talwar

May be this in the preceding load:

LOAD *,

          If(WildMatch([Customer Group], 'N-P*'), 'Customers ',

          If(WildMatch([Customer Group], 'Unk*') as 'Unidentified')) as [Customer Main Group];

LOAD *,

          If(WildMatch(transtype,'*101','*102','*103','*104'),'N-P customer ',

          If(WildMatch(transtype,'*99','*98'),'N-P-N customer ',

          If(WildMatch(transtype,'*89'), 'Unknown customer',

          If(Match(transmovement, 500, 511), 'Others')))) as Customer Group

FROM/Resident;

UPDATE: If you got what you were looking for, I would ask you for your time to go in there and close this thread by marking correct and helpful answers. And for new requirements open a new thread.

Qlik Community Tip: Marking Replies as Correct or Helpful

Best,

Sunny