Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
vikasshana
Creator II
Creator II

Help in Mapping

Hi,

I'm using the below simple code to work on Mapping and ApplyMap.

CustomerTable:

Mapping

Load * Inline

[

CustomerID,ID,Test

1,A,AA

2,B,BB

3,C,CC

4,D,DD

5,E,EE

6,F,FF

7,G,GG

8,H,HH

9,I,II

];

Sales:

Load *

,ApplyMap('CustomerTable', CustomerID) as CustomerCountry,

ApplyMap('CustomerTable', CustomerID) as Test

Inline

[

CustomerID

1

2

3

4

5

];

But it is throwing an error 'Generic tables must contain at least 3 fields'. I would like to see output like below.

CustomerCountry CustomerID TestID
A1AA
B2BB
C3CC
D4DD
E5EE

It is giving me the output which I'm expecting if i create a new test table and Mapping that test table to ApplyMap table but i don't want the Test Table.

Regards,

Bharath Vikas

2 Replies
ali_hijazi
Partner - Master II
Partner - Master II

Mapping tables should only have 2 columns; in your case you should create two mapping tables one for country and one for test ID

A mapping table consists of two columns, the first containing comparison values and the second containing the desired mapping values. Mapping tables are stored temporarily in memory and dropped automatically after script execution.


refer to the below link for more details on mapping tables in Qlik



https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/Scripting/ScriptPrefixes...

I can walk on water when it freezes
snehamahaveer
Creator
Creator

Hello Vikas,

The below code will help with your query. The Mapping load as mentioned above should only have 2 columns.

CustomerTable:

Mapping

Load * Inline

[

CustomerID,ID

1,A

2,B

3,C

4,D

5,E

6,F

7,G

8,H

9,I

];

Sales:

Load

*,

ApplyMap('CustomerTable', CustomerID) as CustomerCountry,

ApplyMap('CustomerTable', CustomerID)&ApplyMap('CustomerTable', CustomerID) as Test;

Load * Inline

[CustomerID

1

2

3

4

5

];

Regards,

Sneha