cancel
Showing results for 
Search instead for 
Did you mean: 

Ignore mapping if empty

manohar
Contributor

hi there,
how can I ignore the mapping if I am not getting any values? example in the below screenshot for the record, there’s no attachment so mapping should not happen. for this example since no attachement its failing in the downstream snaps.

image
Thanks
Manohar

13 REPLIES 13

Hi @manohar

I think it’s possible in a mapper snap with this expression and as target path nothing.
I had this question also before to delete the fields that are empty and had this solution below

Expression: jsonPath($,“$…[?(value == {}) ]”)
The expressions checks the paths if they are null and then delete them if so. After that you need a next mapper snap that checks all the fields of null values and delete them.

Example in the pipeline with mapper snap below

The reason for two snaps is I think that you first need to check the values inside the array and after that you can check the higher parent for null values. I think you will understand if you check the pipeline.

If there is a more efficient way I am happy to hear.
Test_Pip_V1.3_2022_10_26 (1).slp (6.2 KB)

Thanks @JensDeveloper if I go with that, then it would drop other required fields, although they are null. so it’s just some fields like the attachment (as it’s actually a related record) need to be dropped.

Thanks
Manohar

Hi @manohar ,

As I wrote in my post above, you can use the Router and proper mappings after them.

bojanvelevski
Valued Contributor

You can directly replace Copy + Filters with a Router. You can accomplish this by updating the expression in the Mapper(Filter) snap. Check pipeline below:

mytransformation_2022_10_26.slp (69.8 KB)

I would recommend the router version with proper mappings afterwards.

Regards