Using Trim Function
The Trim function in Communication Cloud Service lets you to eliminate selected choice of characters from any leading or trailing spaces and fillers based on a specified position. It uses the <comms-data> tag to return the output.
Parameters | Details |
---|---|
left | Trims the specified characters available in the leading position of the data |
right | Trims the specified characters available in the trailing position of the data |
Syntax
<comms-data>$Data {"Id":"TotalDepositAmount", "Format":"$#,###.00"}
<comms-transform type="trim" left="n" right="n"
char="n"></comms-transform></comms-data>
Replace the n in left to specify true or false.
Replace the n in right to specify true or false.
Replace the n in char to specify the character(s) you want to trim, multiple characters are separated by comma separator. For example, char="$", char="$,-", char="TM".
Example: Package Assembly Template
{
"$$Id": "TrimEvent",
"Fields": [
{
"Name": "TotalDepositAmount",
"Path": "$.TotalDepositAmount"
},
{
"Name": "FundName",
"Path": "$. FundName "
}
]
}
Example: Content Configuration
The total deposited amount for
<comms-data>$Data {"Id":"FundName"}<comms-transform type="trim" left="true" right="true" char="*,$"></comms-transform></comms-data> is <comms-data>$Data {"Id":"TotalDepositAmount", "Format":"#,###.00"}<comms-transform type="trim" left="true" right="false" char="$"></comms-transform></comms-data>.
Example: Sample
Input
{" TotalDepositAmount ": “$125.45”," FundName ": “**Debt Fund A$$”}
Example: Package Output
The total deposited amount for Debt Fund A is 125.45