Analytics Builder 10.14.0 | Using Analytics Builder for Cumulocity IoT | Block Reference | Utility | Text Substitution
 
Text Substitution
apama.analyticsbuilder.blocks.TextSubstitution
Substitutes identifiers marked with a hash and braces (for example, #{name}) in the text template with corresponding entries from the input values.
At least one of the Object or Source input ports must be connected. Identifiers that cannot be resolved are not substituted.
The identifiers prefixed with source. (for example, #{source.name}) are searched for in the value received on the Source input port. For example, if the value received on the Source input port is { "name": "sample_name" }, then the identifier #{source.name} is resolved to sample_name.
The identifiers not prefixed with source. are searched for in the value received on the Object input port.
Nested identifiers can be specified by separating them with a dot (.). For example, when the Object input port has received the value { "address": { "street": { "name": "example_street" }}}, then the identifier #{address.street.name} is resolved to example_street.
Keys with a dot (.) in them are not supported, so if the Object input port value is of the form { "address.street": { "name": "example_street" }}, then the example_street value cannot be resolved because the identifier #{address.street.name} expects street to be nested inside the address entry.
Primitive values such as integer, float, boolean and string are substituted directly, but complex values are converted to a JSON representation before substitution.
Any identifier with the text time (case-insensitive) in it and value type float is interpreted as a timestamp value and is converted into the format yyyy-MM-ddTHH:mm:ss.SSSZ before substitution. This can be modified with optional parameters using the following syntax: {time:param1="value1",param2="value2"}. Use the parameter TZ="time_zone" to specify a different time zone and/or use the parameter FORMAT="format_string" to specify a different format. For example, #{time:TZ="America/New_York",FORMAT="HH:mm:ssZ"} specifies the time zone for New York and the format to be HH:mm:ssZ. The model fails to activate if the time zone is not recognized or the format is invalid.
Note: The format string for the time must not contain quotes (") and braces ({ and }).
A hash (#) can be specified in the text template by escaping it as follows: #{#}.
For more information, see the list of time zones and the list of valid time format strings in the Apama documentation.
Parameters
Name
Description
Type
Notes
Text Template
The text that is used to generate the output by substituting the identifiers in it, such as #{name}, with the values from the input ports.
string
Input Port Details
Name
Description
Type
Object
Used to substitute identifiers that are not prefixed with source.. For example, #{name} or #{timestamp}.
any
Source
Used to substitute identifiers that are prefixed with source.. For example, #{source.name}.
any
Output Port Details
Name
Description
Type
Output
String containing the substitutions from the text template.
string