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