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

marjan_karafilo
Contributor

Hi @manohar ,

You can use Filter snap before the mapping and filter out the records that do not have attachment.

BR,
Marjan

Thanks @marjan.karafiloski but what @bojanvelevski is said is what I was looking for.

bojanvelevski
Valued Contributor

Hi @manohar,

If I understand correctly, you don’t need those fields in the final result, if their value is null ?
If that’s the case, you can try the following expression:

sl.ensureArray($attachments.attachment.filter((v,k)=>v!=null))

and map the Target path as $attachments only.

Let me know if this helps,
Bojan

Hi @bojanvelevski , that’s right.

But wondering with this approach, how can I avoid the target portion?

Thanks
Manohar