Trim
See also: Left trim, Right trim
Value resolver – Abstract
Purpose: Removes marginal whitespace characters from a string passed as input value.
The Trim value resolver removes marginal whitespace characters from a string passed as input value.
If no value ($null) is present as input value, no value ($null) is returned.
For input values that are not strings, their string mapping is processed.
Configuration
The Trim value resolver expects a string as input value and does not use any parameters.
Example
Since Addresses in Lobster Data Platform / Orchestration provide three fields for names (name1, name2, name3), it is occasionally necessary to concatenate them to be sure that the full name for an address is rendered.
If all fields are always used for an address, their values can simply be strung together with an inserted space.
If not all name fields are provided with values for an address, then the concatenated string contains unwanted spaces.
Specific case: The name1 and name3 fields in a user's address should identify her as 'Karola Mustermann', for whom no middle name is specified.
If the standardized salutation for users specifies concatenating name1, name2 and name3 (using spaces), this user will be addressed as 'Karola Mustermann' – with a double space between first and last name.
It would be possible to replace double spaces by a single space, but then there would still be problems with users for whose addresses the name1 or name3 is not filled.
The following configuration catches all (off) cases when populating the name fields without complex case distinctions using the Trim value resolver.
Configuration:
The screenshot shows a configuration for a Message (see Show alert (Popup)), in which all used name components from the address of the logged in user (see User of session) should appear separated by spaces. In the context of an Execute with event action (not shown in the image), the address stored in the user account is already defined as an alternative reference object for the context of the Concat strings value resolver. Text concatenation is done in stages, each followed by a Trim value resolver (per concatenation). This ensures that the space inserted within the concatenation as static text is not left 'marginalized' if one of the concatenated fields does not contain a value. |
|