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

manohar
Contributor

Is it possible to show in a mapper how it should look like. I exported the mapper portion of my pipeline.
mytransformation_2022_10_21 (1).slp (68.3 KB)

Thanks
Manohar

manohar
Contributor

@bojanvelevski @marjan.karafiloski , wondering if you have any pointers based on how my input is?

Thanks for you help,
Manohar

Hi @manohar ,

You can also use Router snap, where you will check if there is attachment, like:

$attachments.get(‘attachment’) != null

image

After that, you can use two different mappers, one without the attachment and one with it.

BR,
Marjan

bojanvelevski
Valued Contributor

You cannot impact the attachments array directly in one mapper, since you have another mappings happening on the same level in the target object.

What you can do though, is add another Mapper that will serve as a filter. The mapper uses the Mapping root to go down to the attachment object and filter out the “type”,“text” and “intent” fields if they are null.

mytransformation_2022_10_25.slp (69.7 KB)

Let me know if this helps,
Bojan.

Thanks @bojanvelevski wondering how can I remove “attachments” node as well, if they are coming as null.

image

I went with this solution for now but trying to reduce no. of snaps to get to that
image

Thanks
Manohar