Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Metalix64
Contributor
Contributor

Why my Applymap return key value ?

Hi there,

I have a problem with my function ApplyMap();

My mapping loads well but when I want to use the function ApplyMap, it returns me the value of the key and not its corresponding value. See the example below :

My Mapping table :

image.png

My other table from QVD file:

image.png

My code :

Mapping:
MAPPING LOAD Distinct
    code,
    family
FROM [lib://PATH\Mapping.xlsx]
(ooxml, embedded labels, table is FPY);

FPY2:
LOAD
    *
FROM [lib://PATH/PROD0145.QVD]
(qvd);

FPY_MAP :
LOAD *,
ApplyMap('Mapping',code) as Mapping
Resident FPY2;

STORE FPY_MAP INTO [lib://PATH/MAPPING_TEST.csv] (txt);

Labels (2)
1 Solution

Accepted Solutions
Somasundaram
Creator III
Creator III

Hi,

 

It seems your mapping table 'code' format is different from fact table.

Please check and change the correct format.

 


-Somasundaram

If this resolves your Query please like and accept this as an answer.

View solution in original post

2 Replies
Somasundaram
Creator III
Creator III

Hi,

 

It seems your mapping table 'code' format is different from fact table.

Please check and change the correct format.

 


-Somasundaram

If this resolves your Query please like and accept this as an answer.
Metalix64
Contributor
Contributor
Author

Hi,

Thank you for your answer, indeed I force the type of my field with the function text () and it works now.

My new code :

Mapping:
MAPPING LOAD Distinct
    text(code) as newcode,
    family
FROM [lib://PATH\Mapping.xlsx]
(ooxml, embedded labels, table is FPY);

FPY2:
LOAD

 text(AGENT) as newcode,
    *
FROM [lib://PATH/PROD0145.QVD]
(qvd);

FPY_MAP :
LOAD *,
ApplyMap('Mapping',text(newcode)) as Mapping
Resident FPY2;

 

Thx.