# Formatting number values

Values of Number custom fields or number constants may be formatted in email templates in various ways. The key to number formatting is the `$!number` variable which is an instance of the NumberTool Jira API class. NumberTool provides buit-in styling for formatting numbers but also provides access to Java NumberFormat API which provides ultimate formatting capabilities. Read more about it [here](https://docs.atlassian.com/software/jira/docs/api/7.6.1/com/atlassian/jira/util/velocity/NumberTool.html).

### Formatting with built-in styles <a href="#howtoformatnumbervalues-formattingwithbuilt-instyles" id="howtoformatnumbervalues-formattingwithbuilt-instyles"></a>

The following is an example of formatting the value of a number field called `"My Number Field"` in various styles.

```
#set ($numberValue = $!issue.getCustomFieldValue("My Number field"))

Integer: $!number.format("integer",$!numberValue)

Number: $!number.format("number",$!numberValue)

Currency: $!number.format("currency",$!numberValue)

Percent: $!number.format("percent",$!numberValue)

Default: $!number.format("default",$!numberValue)
```

### Format with Java Number format <a href="#howtoformatnumbervalues-formatwithjavanumberformat" id="howtoformatnumbervalues-formatwithjavanumberformat"></a>

The following is an example of using Java's NumberFormat to render the number value in Japan's currency:

```
#set ($numberValue = $!issue.getCustomFieldValue("My Number field"))
#set($numberFormat = $!number.getNumberFormat("currency", $!templateSupport.getLocale("jp_JP")))

Currency in Japan: $!numberFormat.format($numberValue)
```


---

# 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.meta-inf.hu/email-this-issue/email-this-issue-for-jira-server-data-center/documentation/outgoing-emails/email-templates/formatting-number-values.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.
