Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
alexandermllr
Creator
Creator

Qlikview - Multiple mapping in one field

Hello,

I have two tabels:

Mapping_Table:

KeyText
1England
2Germany
3Japan

Data_Table:

Key
1, 2
3
1, 2, 3

I want the table:

Text
England, Germany
Japan
England, Germany, Japan

Is this possible, to map multiple values?


Thanks

3 Replies
olivierrobin
Specialist III
Specialist III

hello

maybe something like that

map:

mapping load  * inline [

Key,Text

1,England

2,Germany

3,Japan

];

data:

load * inline [

Key

1,2

3

1,2,3

]    (delimiter is ' ');

for i=0 to NoOfRows('data')-1

    let vOutput='';

    let vListKey=Peek('Key',i,'data');

    trace ** $(vListKey) **;

    for j=1 to SubStringCount(vListKey,',')+1

        let vKey=SubField(vListKey,',',j);

        trace *** $(vKey) ***;

        let vOutput=vOutput & ApplyMap('map',vKey,'***')&',';

    next j

    let vOutput=left(vOutput,len(vOutput)-1);

    Outp:

    load '$(vListKey)' as K,

        '$(vOutput)' as T

        AutoGenerate(1);

       

   

   

next i

exit script;

tresesco
MVP
MVP

Try like:

Map:

Mapping Load * Inline [

Key, Text

1, England

2, Germany

3, Japan

];


Data_Table:

Load

Key,

Concat(MappedSeparated, ',') as MaapedKey

Group By Key;

Load

Key,

ApplyMap('Map', SeparatedKey) as MappedSeparated

;

Load

Key,

SubField(Key, ',') as SeparatedKey;


Load * Inline [

Key

1, 2

3

1, 2, 3] (delimiter is '|');

tamilarasu
Champion
Champion

Hi Alexander,

If "Key" is a field in your "Data_Table", you can use MapSubString function.

Map:

Mapping LOAD Key,

     Text

FROM

[https://community.qlik.com/thread/306964]

(html, codepage is 1252, embedded labels, table is @1);

Data:

LOAD MapSubString('Map',Key) as Text

FROM

[https://community.qlik.com/thread/306964]

(html, codepage is 1252, embedded labels, table is @2);

Capture.PNG