Question
Infomatics Corp
US
Last activity: 25 Feb 2020 23:09 EST
Usage of Functions in JSON Supported Data Transform
Hi,
Does JSON Data transforms supports using of functions before mapping it to the Source?
We are in 8.3.1. version it is allowing to save the data transform, but at run time the functions are not getting evaulated.
Is this is a limitation that we need to use only the response properties as is while mapping?
The purpose of the JSON Data Transform is to model a two-way mapping between a JSON structure and a clipboard model. That is, the Data Transform has to make sense mapping in either direction:
Whilst the Function call may make sense when deserializing JSON to the Clipboard, it won't apply when serializing the Clipboard to JSON as you would need to do the opposite of what the Function call does when deserializing.
To set "Property A" to be the output of a Function call on some data coming from JSON, consider the JSON Data Transform your mapping logic only. In here, map the JSON field that needs to be subject to a Function call to a separate property - "Property B". Then have an 'outer' Clipboard Data Transform - specifically for your response scenario - which calls the JSON Data Transform in DESERIALIZE mode, and then sets Property A to the output of the Function applied to Property B.
Note that when creating Data Types in App Studio [8.3.1] that integrate with other systems of record, the Response Data Transform of the Data Page created by App Studio is architected the same way: an outer Clipboard Data Transform that wraps a call to an inner JSON Data Transform in DESERIALIZE mode.
The purpose of the JSON Data Transform is to model a two-way mapping between a JSON structure and a clipboard model. That is, the Data Transform has to make sense mapping in either direction:
Whilst the Function call may make sense when deserializing JSON to the Clipboard, it won't apply when serializing the Clipboard to JSON as you would need to do the opposite of what the Function call does when deserializing.
To set "Property A" to be the output of a Function call on some data coming from JSON, consider the JSON Data Transform your mapping logic only. In here, map the JSON field that needs to be subject to a Function call to a separate property - "Property B". Then have an 'outer' Clipboard Data Transform - specifically for your response scenario - which calls the JSON Data Transform in DESERIALIZE mode, and then sets Property A to the output of the Function applied to Property B.
Note that when creating Data Types in App Studio [8.3.1] that integrate with other systems of record, the Response Data Transform of the Data Page created by App Studio is architected the same way: an outer Clipboard Data Transform that wraps a call to an inner JSON Data Transform in DESERIALIZE mode.
You could perhaps turn on the "Do not save property data" flag on the Property B ruleform so that this interim state of the integration data is never persisted on your business object that ultimately holds the right value in Property A.