Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
poooja
Creator
Creator

Apply Map function Issue


 

Hi Qlikies,

I came across a below situation in applymap function,

Below is my example:  Here i have to give 'Status'  as a selection but it's not giving expected value as source file bringing extra values which is not matching with the mapping table value.

 

Below is my code:

Mapping_Table:
Mapping LOAD * INLINE [
ID, Status
1, Pass
2, Pass
3, Pass
4, Fail
5, Fail
6, Fail
7, Pass
8, Fail
9, Pass
];


Table:
LOAD ID,
     City,
     ApplyMap('Mapping_Table', ID)As Status
FROM
Applymap.xlsx
(ooxml, embedded labels, table is Sheet1);

 

 

Code providing below output:Capture.JPG

 

Expected Output: only Fail and PassCapture.JPG

Thanks!

Pooja

3 Solutions

Accepted Solutions
niyazymbetov
Contributor II
Contributor II

Hi Poooja

ApplyMap function syntax is:

ApplyMap('map_name', expression [ , default_mapping ] )

You must 3rd value 'default_mapping',  this value will be used as a default value if the mapping table does not contain a matching value for expression. If not stated, the value of expression will be returned as is.

You can read more about Applymap syntax here https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/Ma...

View solution in original post

jonathandienst
Partner - Champion III
Partner - Champion III

Use something like:

ApplyMap('Mapping_Table',  ID, 'Unknown') as Status

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

kushalthakral
Creator III
Creator III

Hi 

 

in Apply map function if ID is not in the mapping table it will show you the actual ID instead of related value suppose 

in mapping table you dont have value for ID 11 then while using apply map function it will show you 11 but if you have value for ID 10 as Yes then it will show Yes

I hope this explains your question

 

Thanks

Kushal

View solution in original post

3 Replies
niyazymbetov
Contributor II
Contributor II

Hi Poooja

ApplyMap function syntax is:

ApplyMap('map_name', expression [ , default_mapping ] )

You must 3rd value 'default_mapping',  this value will be used as a default value if the mapping table does not contain a matching value for expression. If not stated, the value of expression will be returned as is.

You can read more about Applymap syntax here https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/Ma...

jonathandienst
Partner - Champion III
Partner - Champion III

Use something like:

ApplyMap('Mapping_Table',  ID, 'Unknown') as Status

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
kushalthakral
Creator III
Creator III

Hi 

 

in Apply map function if ID is not in the mapping table it will show you the actual ID instead of related value suppose 

in mapping table you dont have value for ID 11 then while using apply map function it will show you 11 but if you have value for ID 10 as Yes then it will show Yes

I hope this explains your question

 

Thanks

Kushal