Formatting variables
In Email and PDF communications, EngageOne™Communicate allows you to specify variables that are displayed in different formats depending on the specified locale. This is useful because these variables are formatted differently in different countries. For example, the number 56025 is written as 56,025 in England or the USA, but 56.025 in Germany and 56 025 in Sweden.
The types of variable that can be formatted in this way are as follows:
- number
- time
- date
- datetime
When a new data source is uploaded, EngageOne™Communicate recognizes fields of these types and adds an appropriate label as a property in the data source structure.
You can then select the appropriate locale from a dropdown list of options.
Further customization can be performed using Advanced Mode.
The following shows an example of uploading a data source with a selected locale:
The Data Standard dropdown allows you to select the locale.
Formatting numeric variables
As described above, the number data type can be formatted according to the selected locale.
However, selecting the locale does not modify the number of decimal places (the maximum supported number of decimal places is 20). This behaviour can be changed by specifying custom settings.
To specify custom settings, open the data source by clicking on it. Then click the Data Schema tab followed by the Advanced Mode button. The data schema is now shown in JSON format, which you can edit.
You can now define the following:
- customThousandSeparator
- customDecimalSeparator
- customDecimalPlaces (default: 0)
These settings will override the default locale format.
An example of a JSON file that defines custom numeric formatting is shown below:
{
"customDecimalPlaces": 4,
"customDecimalSeparator": "?",
"customThousandSeparator": ",",
"location": "number",
"name": "number",
"type": "number"
},
The example result is as follows:
Formatting time variables
As described above, the time data type can be formatted according to the selected locale. However, this behaviour can be changed by specifying custom settings.
When uploading a data source, EngageOne™Communicate will try to define the input format of any time data. If this data is too complex, Communicate will label it as a string type and you must manually provide the input format and change the type to time.
To specify custom settings, open the data source by clicking on it. The click the Data Schema tab followed by the Advanced Mode button. The data schema is now shown in JSON format, which you can edit.
You can now define the following:
- inputFormat
- customTimeFormat
These settings will override the default locale format.
An example of a JSON file that defines custom time formatting is shown below:
{
"customTimeFormat": "h:mm:ss A",
"inputFormat": "X",
"location": "time",
"name": "time",
"type": "time"
}
The example result is as follows:
Formatting date variables
As described above, the date data type can be formatted according to the selected locale. However, this behaviour can be changed by specifying custom settings.
When uploading a data source, EngageOne™Communicate will try to define the input format of any time data. If this data is too complex, Communicate will label it as a string type and you must manually provide the input format and change the type to date.
You can select from three date format options as follows:
To specify custom settings, open the data source by clicking on it. The click the Data Schema tab followed by the Advanced Mode button. The data schema is now shown in JSON format, which you can edit.
You can now define the following:
- inputFormat
- customShortDateFormat
- customLongDateFormat
These settings will override the default locale format.
An example of a JSON file that defines custom date formatting is shown below:
{
"customLongDateFormat": "DD@MMM@YYYY",
"customShortDateFormat": "YYYY+MM+DD",
"inputFormat": "DD-MM-YYYY",
"location": "date",
"name": "date",
"type": "date"
},
The example result for customShortDateFormat is as follows:
Formatting datetime variables
As described above, the datetime data type can be formatted according to the selected locale. However, this behaviour can be changed by specifying custom settings.
When uploading a data source, Communicate will try to define the input format of any time data. If this data is too complex, Communicate will label it as a string type and you must manually provide the input format and change the type to datetime.
To specify custom settings, open the data source by clicking on it. The click the Data Schema tab followed by the Advanced Mode button. The data schema is now shown in JSON format, which you can edit.
You can now define the following:
- inputFormat
- customShortDateFormat
- customLongDateFormat
- customTimeFormat
These settings will override the default locale format.