Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Map_Name:
Mapping
Load * Inline [
ID, Name
1, ABC
2,XYZ
];
Tab:
ID,
Field1,
Field2,
Applymap('Map_Name',ID,ID) as proname
FROM Tab;
Here it will return Name if ID Exist in Mapping Table.
Suppose If i pass ID as 3 Which i dont have the Mapping Table, what it will return??
Please help me out this issue...
Thanks in advance.
regards
Prathap
Hello!
When you pass ID as 3,your new field will be 3 like ID
Map_Name:
Mapping
Load * Inline [
ID, Name
1, ABC
2,XYZ
];
Tab:
load
ID,
Field1,
Field2,
Applymap('Map_Name',ID,ID) as proname
;
load * Inline
[
ID,Field1,Field2,
1, A,B
2,C,D
3,E,F
]
;
The third parameter in Applymap('Map_Name',ID,ID) is the value returned when it doesn't match with the mapping table. Normally we use 'Not available', 'NA' to indicate the missing value but it can be set as per the need.. Thanks.
You do not need to add ID as a third parameter, applymap will use the source field by default if no match is found and the 3rd parameter is not present,
Try
Applymap('Map_Name',ID) as proname,
Applymap('Map_Name',ID, 'Unknown') as proname2,
to see how to use the third parameter in applymap.
Hi Prathap,
In the applymap function if you don't find the matching ID then we have the option to specific what you need to show in such case
Applymap('Map_Name',ID) as proname, if nothing is specified it will return the ID
Applymap('Map_Name',ID,null()) as proname, if ID is missing in mapping table ,this will give null
Applymap('Map_Name',ID,'ID Missing') as proname, this will give a text as ID Missing