cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Is there a way to selectively exclude fields output from a mapper snap?

stephenknilans
Contributor

I have a case where many fields may have to be excluded from mapper output, as if they never existed, selectively during a run. I am going to a cloud instance of a routine that will take null values in, and display them, or may delete wanted values, if this is not implemented correctly. Is there some way of implementing a way to selectively disable/enable the โ€œtarget pathโ€ declaration on a mapper, while it is running? I even tried passing all nulls, and it doesnโ€™t work.

9 REPLIES 9

You need to put $ in the target path so that the result of the cleanupTree() function is used as the new output value. The โ€˜Pass Throughโ€™ option should also be unchecked. Without $ in the target path, lib.objutil.cleanupTree($) is treated as the JSON-Path to delete.

THANKS, that did it! I thought I had tried the โ€œ$โ€ as well, but it works now. THANKS!

Did anything happen to cause this to break? It doesnโ€™t seem to work anymore.

ajs
New Contributor II

I have a similar issue, but this expression library is not working.

@stephenknilans,

For your specific Address example, I found this expression to work:

$Address.filter((v1,k1)=>!v1.value.filter((v2,k2)=>!v2.isEmpty()).isEmpty())

Logically, it also works like this:

$Address.filter((v1,k1)=>v1.value.filter((v2,k2)=>v2.isEmpty()).isEmpty())

No recursion though, so @tstackโ€™s solution is definitely a better approach if thatโ€™s required.