Was this helpful?
Constants
Constants improve processing efficiency because they are evaluated once regardless of how often they are referenced. In case of a target field mapping expression or an event condition action, even a literal string is evaluated every time it is referenced. However, a constant is evaluated only once when the map is initialized. Depending on the string size, this provides a huge performance gain.
Any expression or script can be used to set the constant's value if the script resolves to the constant's type. For example, if the constant is of type Date, then the script that defines it must return a date. If it is of type String, then the script must return a string.
Constants are resolved and evaluated before the TransformationStarted event and hence, scripts only have access to data that is available at that point in time.
Once a constant is defined and set, they are considered similar to fields except their value does not change. They can be referenced in subsequent scripts similar to a field.
A few use cases for constants include:
Hard code literal values in several instances through the map (example, target field expressions, ECA rule expressions, and so on.)
Evaluate a script multiple times based on a constant value that must be calculated pre-transformation.
Evaluate multiple different scripts with a constant value that must be calculated pre-transformation.
Last modified date: 10/22/2024