TransformerDefinition - Scoped, Global
-
- UpdatedJan 30, 2025
- 3 minutes to read
- Yokohama
- API reference
The TransformerDefinition API provides methods to instantiate and manage the TransformerDefinition object, which associates a transformation rules list and a record path.
This API works along with the Transformer and TransformerRuleList APIs. Together, these APIs transform XML nodes or any entity in a structured JSON document into an output of name-value pairs. Supported JSON entities including objects and elements within an array, such as strings, numbers, and other arrays.
The TransformerRuleList API enables you to create transformation rule lists that define what data in the source document to include in the output and how to transform the source data.
The TransformerDefinition API associates a transformation rule list with a JSON/XML record path to define reusable transform definition objects. You can use a transform definition object to transform one or more source documents.
In addition, this object provides methods that enable you to obtain the record path of the TransformerDefinition object. It can also validate whether the definition has a valid TransformerRuleList associated with it.
The Transformer API performs the actual data transformation, one data entity at a time, using the specified transformation rule list to create the desired output data.
You can use the TransformerDefinition class in both scoped and global
server scripts. When using this class, use the sn_tfrm
namespace identifier.
Also, before this API is available in an instance, you must activate the Transformation
Service plugin (com.glide.transform).
TransformerDefinition - TransformerDefinition(Object transformerRuleList, String recordPath)
Instantiates a TransformerDefinition object.
Name | Type | Description |
---|---|---|
transformerRuleList | Object | TransformerRuleList to associate with this transformer definition. |
recordPath | String | Optional. The path (JSONPath for JSON, XPath for XML) that identifies the container (parent) of nodes to parse as records in the source document. For JSON documents, these nodes can be any object, array, or JSON primitive (string, number, boolean). For XML documents, these nodes are the child elements of the container. If recordPath is unspecified, the entire document is inferred as a single record. For JSON documents, if the top node is an array and recordPath is unspecified, then the top array is the record's container, and each of its entries is a record. |
Example
TransformerDefinition - TransformerDefinition(String transformerDefinitionSysId)
Instantiates a TransformerDefinition object using an existing transformer definition.
Name | Type | Description |
---|---|---|
transformerDefinitionSysId | String | Sys_id of a transformer definition. Table: Record Transformer [sys_record_transformer] |
Example
This example instantiates a TransformerDefinition object based on the provided sys_id.
TransformerDefinition - recordPath()
If set when the TransformerDefinition object was instantiated, returns the record path for the source data file associated with the TransformerDefinition object.
A record path (JSONPath for JSON, XPath for XML) identifies the container (parent) of nodes to parse as records in the source document.
For JSON documents, these nodes can be any object, array, or JSON primitive (string, number, boolean). For XML documents, these nodes are the child elements of the container.
If recordPath is unspecified, the entire document is inferred as a single record. For JSON documents, if the top node is an array and recordPath is unspecified, then the top array is the record's container, and each of its entries is a record.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | If set, the record path associated with the transformer definition. If not set, returns null. |
Example
TransformerDefinition - validate()
Validates whether a valid TransformerRuleList is associated with the TransformerDefintion object.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Boolean | Flag that indicates whether a valid TransformerRuleList is associated with the
specified TransformerDefintion object. Valid values:
|