# Merge Field Formatters

### Format Numbers

These formatters can be used on [Whole Number or Decimal field types](/documentation/keep-learning/esl-ubiquitys-scripting-language/data-types.md#integer-and-real-number).

Note: If you want to format a text field with these formatters you will need to [cast the field as a number field](/documentation/keep-learning/esl-ubiquitys-scripting-language/directives.md#cast) first.

| Formatter | Description                                                                                  | ESL Example                        | Output Example              |
| --------- | -------------------------------------------------------------------------------------------- | ---------------------------------- | --------------------------- |
| c         | Currency with $ and 2dp                                                                      | \[Merge(c)]                        | $1,500.00                   |
| n0        | With a comma                                                                                 | \[Merge(n0)]                       | 1,500                       |
| g         | Without a comma                                                                              | \[Merge(g)]                        | 1500                        |
| f or f*n* | Without a comma but with decimal places where *n* = number of decimal places, default is 2dp | <p>\[Merge(f)]<br>\[Merge(f4)]</p> | <p>1500.00<br>1500.0000</p> |
| d*n*      | Set number of digits *n* = minumum number of digits (whole number fields only)               | \[Merge(d6)]                       | 001500                      |
| e*n*      | Exponential where *n* = the number of decimal places, default is 6dp                         | \[Merge(e1)]                       | 1.5e+003                    |
| p         | Percentage with a space in front of the percent sign                                         | \[Merge(p)]                        | 10.01 %                     |
| 0%        | Percentage without a space in front of the percent sign                                      | \[Merge(0%)]                       | 10.01%                      |

### Format Mobile Numbers

These formatters can be used on [Mobile Number field types](/documentation/keep-learning/esl-ubiquitys-scripting-language/data-types.md#string).

Note: If you want to format a text field with these formatters you will need to [cast the field as a mobile number field](/documentation/keep-learning/esl-ubiquitys-scripting-language/directives.md#cast) first.

| Formatter | Description                                                                        | ESL Example  | Output Example         |
| --------- | ---------------------------------------------------------------------------------- | ------------ | ---------------------- |
| f         | Friendly format with spaces                                                        | \[Merge(f)]  | 021 123 456            |
| f0        | Friendly format without spaces                                                     | \[Merge(f0)] | 021123456              |
| fz        | Friendly format for NZ mobile numbers only, will return null for any non-NZ number | \[Merge(fz)] | <p>021 123 456<br></p> |
| g         | National with country code (e.g. 64), no spaces                                    | \[Merge(g)]  | 6421123456             |
| i         | International with + country code (e.g. +64), no spaces                            | \[Merge(i)]  | +6421123456            |

### Format Dates

These formatters can be used on [Date and Date/Time field types](/documentation/keep-learning/esl-ubiquitys-scripting-language/data-types.md#string).

Note: If you want to format a text field with these formatters you will need to [cast the field as a date field](/documentation/keep-learning/esl-ubiquitys-scripting-language/directives.md#cast) first.

You can combine each of these to format your date as required. For example:

```
[Merge(dddd, d MMMM yyyy)] = Monday, 1 March 2010
[Merge(dd/MM/yy)] = 01/03/10
[Merge(hh:mm:ss tt)] = 09:25:36 am
```

| Formatter | Description                       | ESL Example    | Output Example |
| --------- | --------------------------------- | -------------- | -------------- |
| dddd      | Formats day of week to full text  | \[Merge(dddd)] | Tuesday        |
| ddd       | Formats day of week to short text | \[Merge(ddd)]  | Tue            |
| dd        | Formats day of month to 2 digits  | \[Merge(dd)]   | 03             |
| d         | Formats day of month to 1 digit   | \[Merge(d)]    | 3              |
| MMMM      | Formats month to full text        | \[Merge(MMMM)] | April          |
| MMM       | Formats month to short text       | \[Merge(MMM)]  | Apr            |
| MM        | Formats month to 2 digits         | \[Merge(MM)]   | 04             |
| M         | Formats month to 1 digit          | \[Merge( M)]   | 4              |
| yyyy      | Formats year to 4 digits          | \[Merge(yyyy)] | 2010           |
| yy        | Formats year to 2 digits          | \[Merge(yy)]   | 10             |
| hh        | Include hours                     | \[Merge(hh)]   | 11             |
| mm        | Include minutes                   | \[Merge(mm)]   | 30             |
| ss        | Include seconds                   | \[Merge(ss)]   | 00             |
| tt        | Include am/pm                     | \[Merge(tt)]   | am             |

### Format GUIDs

These formatters can be used on [GUID field types](/documentation/keep-learning/esl-ubiquitys-scripting-language/data-types.md#string).

Note: If you want to format a text field with these formatters you will need to [cast the field as a Unique Identifier field](/documentation/keep-learning/esl-ubiquitys-scripting-language/directives.md#cast) first.

| Formatter | Description                                 | ESL Example | Output Example                         |
| --------- | ------------------------------------------- | ----------- | -------------------------------------- |
| b         | Braces and dashes                           | \[Merge(b)] | {00000000-0000-0000-0000-000000000000} |
| d         | No braces, with dashes                      | \[Merge(d)] | 00000000-0000-0000-0000-000000000000   |
| n         | No braces and no dashes                     | \[Merge(n)] | 00000000000000000000000000000000       |
| p         | Parentheses rather than braces, with dashes | \[Merge(p)] | (00000000-0000-0000-0000-000000000000) |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ubiquity.co.nz/documentation/keep-learning/esl-ubiquitys-scripting-language/merge-field-formatters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
