AnsweredAssumed Answered

Creating extensible defaults on a map

Question asked by simon.wallis287933 on Aug 10, 2016
Latest reply on Aug 10, 2016 by simon.wallis287933

I have a requirement to use different default values on a map output depending on the environment the process is running in.  Reading up on extensions suggests that destination profiles can't have default values if you want to extend the map, so I was looking for another way to achieve this.

 

My first idea was to use a process property with a default value.  Then in the map (with function ordering enabled) I do a 'set properties' taking in the value from the source profile, and a 'get properties' sending that same property to the destination profile.  The idea being that if there is nothing in the source profile, the 'get properties' will return the default value of the Process Property.  This works if the field isn't provided in the source profile, but if (e.g.) the XML tags are present but with no value inside, the Process Property takes on a value of null and this gets set on the output profile instead of the default.

 

Alternately I tried a custom function containing a groovy script.  This takes the source profile value and the Process Property, checks the values and outputs the appropriate one.  However, if the field is not present in the source profile, the function doesn't get invoked so no default value is set.

 

I guess I could include another field that I am certain will be present as an input to the function, to ensure it gets invoked.  But I was wondering if anyone had any better ideas on how to achieve this functionality?  Its something I'll need to use quite a bit across many maps so was hoping there might be a cleaner solution...

Outcomes