Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
alexandermllr
Contributor

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

Tags (2)
3 Replies
olivierrobin
Valued Contributor III

Re: Qlikview - Multiple mapping in one field

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;

MVP
MVP

Re: Qlikview - Multiple mapping in one field

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 '|');

Re: Qlikview - Multiple mapping in one field

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