Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
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).
for 1=10 and for 6=6
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
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.