FreeMarker Formatting Method
NetSuite formatting is lost when you customize NetSuite standard fields. If you print hard-coded values which came from a custom data source or were calculated from standard fields, the format won't match the format of standard record fields. When editing the template source code, the nsformat_*() formatting method makes it possible to format FreeMarker custom variables in the same way NetSuite formats standard fields. It also decreases the need for hardcoding. The nsformat_*() method formats the specific string, number, date, or amount results in the same format used on a standard NetSuite field. With this formatting method, it's possible to apply localization to custom variables, ensuring consistent output.
The following table shows some examples of standard fields in use:
|
Example |
Output |
|---|---|
|
|
1,234 |
|
|
1235 |
|
|
1,235 |
|
|
Dec 18, 2019 5:05:00 AM |
The following table shows some examples of the ${nsformat_*()} formatting method in use:
|
Method |
Example |
Output |
|---|---|---|
|
|
|
12/4/2018 |
|
|
|
Dec 4, 2018 2:40:00 AM Dec 4, 2018 10:40:00 AM Dec 4, 2018 10:40:00 AM |
|
|
|
10:40:00 AM |
|
|
|
€10,20 |
|
|
|
$32.00 |
|
|
|
999,999,999.99 999 999 999,99 |
|
|
|
Yes |
|
|
|
***** |
|
|
|
100% |
|
|
|
clickable email address |
|
|
|
clickable link |
Formatters accept numbers in double precision floating point representation.
If the input is an empty string or null value, then the output is also represented as an empty string.
Related Topics
- Syntax for Advanced Template Fields
- Entering a Field Manually to an Advanced Template
- Syntax for Body Fields
- Syntax for Sublist Fields
- Syntax for Address Subrecords
- Syntax for Fields from Joined Records and Searches
- Updating a Statement Template to Support Multiple Currencies
- File Cabinet FreeMarker Directive