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

Apply Map Does NOT Work

so I try to associate "Yes" or "No" value to the dimension field of 'Connect_Key'   by using apply map

what I have is 

# Mapping_Table

Mapping Load

Connect_Key,

'YES' as Map_Value

From.....

 

#Fact_Table:

Load *,

applymap('# Mapping_Table',Connect_Key,'No') as Map_Value

 

From......

 

it ends up with all the value at Map_Value as "No". but I know there are should be some "Yes" there.

 

wondering if that is due to the 'YES' as Map_Value ...how can I fix this.

 

 

 

 

Labels (1)
2 Solutions

Accepted Solutions
Jebrezov
Contributor III

What type of data is in the connect_key field? Could it be a data type mismatch? Maybe apply the text function to them both to force them to be text?

View solution in original post

rwunderlich
Partner Ambassador/MVP

It's possibly a mismatch between the keys, like one value has leading/trailing blanks and the other does not. My approach to debugging this is to remove the mapping prefix to create a regular table and examine both sets of values in the Data Model Viewer or the UI.

-Rob

View solution in original post

7 Replies
Jebrezov
Contributor III

it looks like you don’t have the correct mapping table name in the applymap. I actually don’t know what # does to a Qlik table name, so I would just name the first mapping table as Mapping_Table. Then in the apply map your first parameter should match the mapping table name ‘Mapping_Table’ including the single quotes.

I think that may be the cause.

coloful_architect
Creator II
Author

sorry...that was a careless typo......but other than that, everything looks ok ,right ...should return me Yes if the value at Fact table matches the key at Mapping_Table ...otherwise, no right?   but all I get is No....

Jebrezov
Contributor III

What type of data is in the connect_key field? Could it be a data type mismatch? Maybe apply the text function to them both to force them to be text?

Ahidhar
Creator III

where is the mapping table getting its data from ?

rwunderlich
Partner Ambassador/MVP

It's possibly a mismatch between the keys, like one value has leading/trailing blanks and the other does not. My approach to debugging this is to remove the mapping prefix to create a regular table and examine both sets of values in the Data Model Viewer or the UI.

-Rob

coloful_architect
Creator II
Author

yeah...sort of ...it turns our the one key is numeric/integer and the other is text.

coloful_architect
Creator II
Author

that is the reason. one key is numeric and the other is integer