Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

One to many match using wildmatch

Can anyone  help me out if the problem is to find one to many matches? I used for loop with wildmatch but the output has one row (proabably the last match) instead of multiple rows for each string.
Here is an example:

table1:

LOAD * INLINE [

match, description

*LS01*, team1

*LS02*, team2

*LS03*, team3

];

table2:

LOAD * INLINE [

string, value

AALS01DDLS02, 10

ABLS01EELSO3, 20

ACLS02GG, 50

LLLS02EE, 10

RRLS03QQ, 50

TTLS05QQ, 10

];

The output required is:

AALS01DDLS02, 10    team 1

AALS01DDLS02, 10    team 2

ABLS01EELSO3, 20   team 1

ABLS01EELSO3, 20   team 3

ACLS02GG, 50          team 2

LLLS02EE, 10           team 2

RRLS03QQ, 50         team 3

TTLS05QQ, 10           others

3 Replies
sunny_talwar
MVP
MVP

May be this:

table1:

Mapping

LOAD match,

  '/' & description & '\' as description

INLINE [

match, description

LS01, team1

LS02, team2

LS03, team3

];

table2:

LOAD *,

  If(Len(Trim(TextBetween(MapSubString('table1', string), '/', '\'))) = 0, 'Others', TextBetween(MapSubString('table1', string), '/', '\')) as description;

LOAD * INLINE [

string, value

AALS01DDLS02, 10

ABLS01EELSO3, 20

ACLS02GG, 50

LLLS02EE, 10

RRLS03QQ, 50

TTLS05QQ, 10

];

swuehl
Champion III
Champion III

I think this will not do the mapping to different keys, but you can expand the sample using something like e.g. is shown here:

Re: Keyword Mapping with Description

swuehl
Champion III
Champion III

table1:

Mapping

LOAD match,

  '/' & description & '\' as description

INLINE [

match, description

LS01, team1

LS02, team2

LSO3, team3

];

table2:

LOAD *,

  If(MappedValueCount, Textbetween(MapSubString('table1', string),'/','\',iterno()), 'Others') as Description

While SubStringCount(MapSubString('table1', string),'/') >=iterno() or iterno() = 1;

LOAD *,

  SubStringCount(MapSubString('table1', string),'/') as MappedValueCount,

  MapSubString('table1', string) as MappedValue;

LOAD * INLINE [

string, value

AALS01DDLS02, 10

ABLS01EELSO3, 20

ACLS02GG, 50

LLLS02EE, 10

RRLS03QQ, 50

TTLS05QQ, 10

];