cancel
Showing results for 
Search instead for 
Did you mean: 

Map the target column only if there is a value coming for the column from source

anubhav_nautiya
Contributor

Hi, we have a requirement where we have to map the target column only if there is a value coming for the column from source, if not we just dont have to send data for that particular field.

for example: both the source file and target DB has columns like firstname,lastname and city.
Now for any record say if first name is blank in source file, we should not map it but the other columns should be mapped.

if for any field the value is blank, the idea is to persist the existing DB value for that field

If anyone has any idea on how to achieve this in a mapper, please help.

Regards
Anubhav

1 ACCEPTED SOLUTION

nsingam
Employee
Employee

@anubhav.nautiyal
I think your requirement can be achieved in the two-step process.

  1. Assign a null value for all those fields whose value is null or empty or the field itself is missing in source.
  2. Use expression on whole object and filter the fields whose value is null.
    With the above two steps you can achieve what you are required. Here I am also providing the sample pipeline.
    Map_only_existing_values_2019_11_14.slp (6.1 KB)

View solution in original post

2 REPLIES 2

nsingam
Employee
Employee

@anubhav.nautiyal
I think your requirement can be achieved in the two-step process.

  1. Assign a null value for all those fields whose value is null or empty or the field itself is missing in source.
  2. Use expression on whole object and filter the fields whose value is null.
    With the above two steps you can achieve what you are required. Here I am also providing the sample pipeline.
    Map_only_existing_values_2019_11_14.slp (6.1 KB)

I think this should work for me, will try this.
Thank you for your help.

Regards
Anubhav