Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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

Tags (2)
3 Replies

Re: One to many match using wildmatch

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

];

MVP
MVP

Re: One to many match using wildmatch

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

MVP
MVP

Re: One to many match using wildmatch

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

];

Community Browser