02-02-2018 12:38 PM
Hi
In a mapper, how could i do so that, depending on the left side expression, i can choose if a target path variable should be output or not.
For example,
if $a is null, then nothing should be output in target path… else, it should output the value of $a.
I found if i define this target path, it will always be output no matter what.
so in above screenshot, if $a has no value, then $test should not be output at all. How to do that then?
02-03-2018 10:06 AM
Unfortunately, there’s no direct way to do that at the moment. One option is to use a second mapper to delete the property if it is null using a path like $[?(key == 'a' && value == null)]
. It’s a reasonable, if uncommon, request. I’ll file feature request and see if we can come up with a solution.
02-04-2018 04:44 PM
Thanks, we need such things a lot. And in some other ESB tools in industry, they have something like optional paramters. But this is not a term in Snaplogic yet.
BTW. you mentioned about 2 mappers, could you please elaborate it a little bit? How I can construct the 2nd mapper?
Thanks