Mapping in mapper from file

I have a requirement where i need to map 200 columns from source to target and source and targets names doesn’t match. Also window of mapper component is very small and it is very tedious to map in snap if columns are large. Is there a way that i can create source to target maping in excel and upload to mapper component…

@yash.verma Unfortunately no way to upload any excel in mapper. You can either use auto link property to map automatically based on the source and target system then change the target name accordingly or can select all from source side and drag and drop any filed in mapping expressing text box , it will populate all selected input in mapper but you have to named targeted variable accordingly.

That sounds like a great enhancement request! What I’ve seen done elsewhere is to use a google sheet or other external file, and call that within your pipeline to get the mappings.

Hi everyone,
You may keep mapping file of source and target fields. For instance, if your create the array of mapping among source and target fields (e.g. [sourcefield, targetfield]) as follows:
{
“fields_map”: [
[
“source_field_1”,
“target_1”
],
[
“source_field_2”,
“target_2”
]
]
}

then you can use the following statement in the mapper:
$.mapKeys((value, key) => $fields_map.find(x => x[0].toLowerCase() == key.toLowerCase()) !=null ? $fields_map.find(x => x[0].toLowerCase() == key.toLowerCase())[1] : key)

If you want to have only mapped fields in the output, you can set filtering with mapper snap as follows:
$.filter((value, key) => ($fields_map.length > 0 ? $fields_map.filter(x => x[1].toLowerCase() == key.toLowerCase()).length>0 : true))

$fields_map can be generated by reading values from CSV file and by using one additional mapper snap.

Regards,
Lazo

2 Likes