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

Calculated expressions (functions) in mapping load resp ApplyMap

Merry Christmas to QlikCommunity!

Is it possible to use functions in mapping tables which are going to be evaluated whenn using ApplyMap? I almost found nothing about this scenario and I tried all kind of variations but with no success.

Very simple example: In a table I have fields COMPANY and SALES_OFFICE. For certain values of COMPANY I want to have the first two characters of SALES_OFFICE, for certain values the last two characters and for all the others the whole string SALES_OFFICE (would be default mapping value). In reality the case is more complex but I wanted to simplify as much as possible. 

In my trials I worked with something like that:

 

MAP_TABLE:
LOAD * INLINE [
COMPANY,FUNCTION
Company1,'left(SALES_OFFICE,2)'
Company2,'left(SALES_OFFICE,2)'
Company3,'right(SALES_OFFICE,2)'
];

DATA:
LOAD 
COMPANY,SALES_OFFICE,
Evaluate(ApplyMap('MAP_TABLE',COMPANY,SALES_OFFICE)) as MAPPED_SALES_OFFICE
FROM ......;

 

I fiddled around with double quotes, variables etc. etc. but didn't get it to work. I'm not quite sure but I think I once saw a working example for a similar scenario long ago .... Any help appreciated.... For me it's important to know if this CAN be done in this way (with mapping) - I have some workarounds at hand but I don't want to use them if it can be done as suggested.

Thx for any suggestions,

Rgds,

Joachim

10 Replies
biester
Specialist
Specialist
Author

Hi Kush,

you will be right I think. The mentioned example I saw long ago must have covered some other scenario. So the conclusion after all is that obviously there is no straight forward approach for using functions in mapping tables in the way I mentioned.

Thx & rgds,

Joachim