Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
prayner
Contributor III
Contributor III

Combining mapping load and wildmatch

Say I have the following data sample:

ClientID Transaction  Description
001 1 green leather
001 2 red car
001 3 black sky
002 1 grey shirt

 

I want to add a new field with information about the client using wildmatching and a mapping table, printed below:

[model]:
LOAD * INLINE
[
pattern, model_name
*leather*, CLOTHING
*sky*, AVIATION
*car*, MOTOR
*shirt*, CLOTHING
];

How can I create the desired output using the mapping table:

ClientID Transaction  Description model_name
001 1 green leather CLOTHING
001 2 red car MOTOR
001 3 black sky AVIATION
002 1 grey shirt CLOTHING

 

My current solution uses a nested if statement, but it is not a clean solution and is not sustainable long-term when the table gets bigger.

if(WildMatch(Description, '*leather*', '*shirt*'), 'CLOTHING
if(WildMatch(Description, '*sky*'), 'AVIATION',
if(WildMatch(Description, '*car*'), 'MOTOR',
'UNIDENTIFIED'))) as model_name

Labels (1)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can use a table to generate a pick(match()) expression that simulates using  wildcards in a mapping table. Download this example for details: 

https://qlikviewcookbook.com/list-recipes/#squelch-taas-accordion-shortcode-content-13

-Rob

View solution in original post

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can use a table to generate a pick(match()) expression that simulates using  wildcards in a mapping table. Download this example for details: 

https://qlikviewcookbook.com/list-recipes/#squelch-taas-accordion-shortcode-content-13

-Rob