Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ananyaghosh
Creator III
Creator III

So can we use 'Mapping' with 'ApplyMap' in a single table mapping?

Hi,

I am using the below code and here I have used 'Mapping' with 'ApplyMap' , but when I am using this mapping in another ApplyMap(), it does not replace [Trn Key] with the channel name.

[Map_D_FIRM]:

Mapping

LOAD

  ApplyMap('Map_F_SALES_TRN', "Firm ID") as [Trn Key],

  "Firm Channel Desc" as "Channel Name"

resident [D_FIRM];

So can we use 'Mapping' with 'ApplyMap' in a single table mapping?

Thank,

Sandip

5 Replies
marcus_malinow
Partner - Specialist III
Partner - Specialist III

sandip,

there is no issue in using ApplyMap within a Mapping load. I'd suggest that if you are having issues with this final mapping table you try creating you mapping table initially as a normal table to make sure that it at least associates with the target table.

Marcus

arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi  Sandip,

You Cant do like this. Qlik can not understand which fields should map. And What is your purpose behind it.

Thanks,

Arvind Patil

marcus_malinow
Partner - Specialist III
Partner - Specialist III

Arvind,

you're wrong. As long as your mapping tables are set up correctly, you can use a nested ApplyMap.

For example:

Map1:
MAPPING LOAD * INLINE
[From1, To1
A, AA
B, BB
]
;

Map2:
MAPPING LOAD
ApplyMap('Map1', From1) as From2,
Description
;
LOAD * INLINE [
From1, Description
A, ThisShouldBeMappedByAA
B, ThisShouldBeMappedByBB
C, ThisShouldBeMappedByC
]

;

FinalTable:
Load
From2,
ApplyMap('Map2', From2, 'Unmapped') as NestedMapResult,
Mapped;
LOAD * INLINE
[From2, Mapped
AA, Yes
BB, Yes
CC, No
C, Yes but via C
D, No
]
;

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Sandip,

Are you trying to do an ApplyMap when creating another MAPPING table, using a nested ApplyMap as Marcus suggests?

You can get a better picture of what ApplyMap is doing if you add a third parameter, something like:

ApplyMap('Map_F_SALES_TRN', "Firm ID", 'Not Found: ' & "Firm ID") as [Trn Key],

The extra parameter proves what is going on.  If the map name is missing Trn Key will be null.  If all values are prefixed with Not Found then the map exists but there is no match between the first field in the mapping table and the "Firm ID".

If there are no matches check for things like spaces and the case of the values (adding Trim and Upper can help),

This blog post on ApplyMap covers all kinds of scenarios, including nested ApplyMap:

https://www.quickintelligence.co.uk/applymap-is-it-so-wrong/

Hope that helps,

Steve

sasiparupudi1
Master III
Master III

Hi Sandip

your code should work fine.

I would suggest that you make a copy of the map table as a normal table to see if the applymap is returning the correct key values in your final mapping table or not.

[Map_D_FIRM]:

Mapping

LOAD

  ApplyMap('Map_F_SALES_TRN', "Firm ID") as [Trn Key],

  "Firm Channel Desc" as "Channel Name"

resident [D_FIRM];

[Test Map_D_FIRM]:

LOAD

  ApplyMap('Map_F_SALES_TRN', "Firm ID",'No match Found') as [Trn Key],

  "Firm Channel Desc" as "Channel Name"

resident [D_FIRM];

exit script;

At this point you could inspect the contents of the table either using table viewer or  chart/table box objects