Formatting values
The Format String property sets how a template control shows the value bound to it: the number of decimals, the thousands separator, the date layout and the text around the value. A second way is the alameen functions, which follow the program options. This page describes both ways and when to use each.
Set a format string
- Select the control bound to a field, such as a text that shows
[Price]. - In the Properties panel, open the Format String property, and then click its button to open the Format String Editor window.
- Choose the format or type it, and then close the window.
| Item in Format String Editor | What it does |
|---|---|
| Category | Groups the formats, such as numbers and dates. Choose the category to see its formats. |
| Standard Formats | A list of ready-made formats for the chosen category. |
| Custom Formats | Where you type the format string yourself. |
| Sample: | Shows how a sample value looks with the chosen format before you save it. |
If you choose the general format, the window shows "General format has no specific number format", which means it adds no number format.
Format string syntax
A format string is written between braces. Inside them 0 is the value, followed by a colon and the format code. Text outside the braces prints as it is. The type of the value matters: a number format does not suit a text value.
| Format | What it does | Value | Result |
|---|---|---|---|
{0:N2} | A number with a thousands separator and two decimals. | 1250.5 | 1,250.50 |
{0:F2} | A number with two decimals and no thousands separator. | 1250.5 | 1250.50 |
{0:N0} | A whole number with a thousands separator. | 1250.5 | 1,251 |
{0:P1} | A percentage with one decimal. | 0.255 | 25.5% |
{0:dd-MM-yyyy} | A date with day, month and year. | 5 December 2026 | 05-12-2026 |
{0:HH:mm} | A time with hours and minutes. | 2:30 in the afternoon | 14:30 |
Total: {0:N2} | Fixed text before the value. | 1250.5 | Total: 1,250.50 |
alameen functions instead of a format string
The functions ToPrice, ToQuantity, ToExchangeRate, ToDate, ToDateTime and ToTime return the value formatted by the program options: the decimals for prices, quantities and exchange rates, the thousands separator and the date layout. They are described in alameen functions. Only an administrator changes the number options behind ToPrice, ToQuantity and ToBalance, and the change applies to every user of the company file.
| You want | Use |
|---|---|
| The template to follow the options of the company, so the decimals change when the company changes them | The function, such as ToPrice([Price]) in the expression of the control. |
| A fixed format that does not change with the options | Format String. |
| The value to be added, compared or sorted | Format String, and keep the value a number. |
These functions return text, not a number. Do not use them in an expression that adds, compares or tests a numeric value. The number functions accept a numeric field, and the date functions accept a date field only.
Example: an invoice line
A line of a sales invoice has a price of 1250.5, a quantity of 10 and an invoice date of 5 December 2026.
- For the price, set Format String to
{0:N2}. The preview prints1,250.50. - For the quantity, write the expression
ToQuantity([Quantity]). The preview prints the quantity with the number of decimals set in the numbers options of the program. - For the date, write the expression
ToDate([Date]). The preview prints05-12-2026while the date layout in the options is the default one.
Related
This page applies to alameen ERP 10, version 10.1.79.764.