Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 |
---|---|---|
A | 1 | AA |
B | 2 | BB |
C | 3 | CC |
D | 4 | DD |
E | 5 | EE |
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
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
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