Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
kundan_sharma1
Contributor III
Contributor III

In Mapping Load if there is no value against the key,So what will be returned for that key

For example

mapping table

Tab1:

key,Price

1,10

2,20

3,30

4,40

5,50

1,60

Tab2:

key,Name

1,A

2,B

3,C

4,D

5,E

6,F

above table shows mapping load

So, what will it return for key =1?........since there are two values for the key 1 in the first table

what will be the value for key =6?

Regards

Kundan Sharma

1 Solution

Accepted Solutions
abhijith862
Contributor III
Contributor III

Mapping Load displays the value in the corresponding first field. So it will return the value for 1 as 10 and 6 will return the value as 6 as it will not find any corresponding value for 6

View solution in original post

5 Replies
abhijith862
Contributor III
Contributor III

Mapping Load displays the value in the corresponding first field. So it will return the value for 1 as 10 and 6 will return the value as 6 as it will not find any corresponding value for 6

ben_pugh
Creator
Creator

applymap('mapname', expr [ , defaultexpr ] )

The value of the 'default expression' parameter is returned if there is no matching value.

If 'default expression' is omitted then the value is returned unchanged (i.e. is not mapped).

arvind1494
Specialist
Specialist

for 1=10 and for 6=6

d_ankusha
Creator II
Creator II

IN  mapping load ,

for key=1 the value returned will be 10 as the mapping load only give out the first matched value

for key=6 the value returned will be 6 i.e. the key value , as here there exist no value for key=6

jaumecf23
Creator III
Creator III

Case Key 1 :

The applymap will return the value 10. From my experience, applymap returns the first field that it finds in the table. This behaviour could change and it's not a good idea to have repeated id's in the table.

Case Key 6 :

When the applymap is not able to find a solution, it returns the map_id value, in this case 6. I don't know if you know that you can introduce a default value to return when no match is found.