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.