Transforms
- Last UpdatedMar 24, 2025
- 3 minute read
Any value in the mapping (except for the name of an attribute) permits transformation of the source value.
<Attribute>
<Conditions>
<Attribute name="ClassName" pattern="PUMP" />
<Attribute name="Name" pattern="^.*$" />
</Conditions>
<Name value="Maximum Pressure" />
<Value value="[max_pressure]">
<Transforms>
<LowerCase />
<Remove pattern="^[a-z]{3}" />
<Replace pattern="\d{6}" value="yyyyyy" />
<InsertAfter pattern="yyyyyy" value="Before " />
<InsertBefore pattern="yyyyyy" value=" After" />
<UpperCase />
</Transforms>
</Value>
<Units value="psi" />
</Attribute>
The following transformations of the source value are available:
|
Transformation |
Description |
|
Remove |
Permits parts of the source value to be removed. The pattern specifies a regular expression used to identify part of the value to remove. |
|
Replace |
Permits parts of the source value to be replaced. The pattern specifies a regular expression used to identify part of the value to replace, and the value specifies the replacement text. |
|
Keep |
If matched to the pattern, Keep will replace the source value with the part of the text that matches the pattern. The pattern specifies a regular expression. If the pattern is not matched, then the source value is set to blank and a warning is logged. |
|
InsertAfter |
Permits the insertion of text after a position in the value specified by a Pattern and the value specifies the text to insert. |
|
InsertBefore |
Permits the insertion of text before a position in the value specified by a Pattern, and the value specifies the text to insert. |
|
Uppercase |
Converts the value to upper case. |
|
LowerCase |
Converts the value to lower case. |
|
Compose |
Reconstructs a string. The string value can be shortened, divided with regular expression and the parts concatenated in any order using a constructor mask. Parts can be used multiple times. |
It is possible to include any number and type of transformations for a given value. The values specified for the Replace and Insert transforms may reference other attributes from the source system, for example, [attribute_name]. If you specify multiple transformations, the transforms are processed in the order listed in the configuration. Transforms may be combined with lookups. In this case, the transform is applied first and the resulting value is passed to the lookup as a key. When using transformations, it is recommended that you specify pattern to ensure the attribute value is in the format expected by the transformation sequence.
Example of a Compose Delimiter:
Input: "Tool designation: P-01A 4000"
<Transforms>
<Keep pattern="[A-Z]-\d{2}[A-Z]" />
<Compose delimiters="-" constructor="type: {1}, series: {2}" />
</Transforms>
Output: "type: P, series: 01A"
Description:
-
Keep parameter shortens input into "P-01A".
-
delimiters "-" then divides it into parts: "P" and "01A".
-
constructor parameter inserts the parts {1} and {2} with respect to the masks: "type: {1}, series: {2}".
Using Space as a Compose Delimiter
When defining transformations in Compose, if a space needs to be the delimiter value then use "\s" to define space as a delimiter rather than a space character (" ").
Using \s instead of a regular space prevents misinterpretation and ensures proper parsing of the attribute values.
Example Configuration
<Object>
<Conditions>
<Attribute name="ClassID" pattern=".*" />
</Conditions>
<Attributes keepUnmappedAttributes="True">
<Attribute name="Type">
<Name value="NewType" />
<Value value="[Type]">
<Transforms>
<InsertBefore pattern=".*" value="#" />
<Replace pattern="-" value=" " />
<InsertAfter pattern="Connector" value="#" />
<Keep pattern=".*" />
<Compose delimiters="\s" constructor="{2} ## {3}" />
</Transforms>
</Value>
</Attribute>
</Attributes>
</Object>