Skip to main content
This page lists all available MDX formats for the FORMAT_STRING cell property, along with their support in Atoti. The official documentation for the formats can be found on the Microsoft website.

Introduction

The FORMAT_STRING cell property specifies how to format both string and raw numeric values. The following tables detail the syntax and the available formatting characters that can be used for the property. Atoti uses the FORMAT_STRING cell property to format the VALUE, storing the formatted value in the FORMATTED_VALUE cell property. This behavior conforms to Microsoft’s specification regarding these properties. On the client’s side, Atoti UI directly uses the formatted values from the FORMATTED_VALUE cell property. Excel behaves differently for measures and does the formatting on the client, ignoring the FORMATTED_VALUE cell property. This implies that:
  • formats that are unsupported or partially supported may still be rendered correctly in Excel.
  • custom formatters defined within Atoti will be ignored.
The formatting of other formattable elements such as dimension members behaves the same way both in Excel and Atoti UI. The following symbols used throughout the page describe support in Atoti for the standard formatting syntax.

Numeric Formats

When designating a numeric formatter, the format string must be enclosed with either DOUBLE[] or INT[] (example: DOUBLE[#.###]). DOUBLE and INT can be used interchangeably. They accept the same format strings and produce the same results.

Sections

A user-defined format expression for numbers can have anywhere from one to four sections, separated by semicolons. If the format argument contains one of the named numeric formats, only one section is allowed.

Characters

The following table lists the characters that can appear in the format string for numeric formats.

Named Numeric Formats

The following table lists the predefined numeric format names.

String formats

String formatting syntax is currently not supported in Atoti.

Sections

Characters

The following table lists the characters that can appear in the format string for string formats.

Date Formats

When defining a date formatter, the format string must be enclosed by DATE[] (example: DATE[yyyy/q]).

Characters

The following table lists the characters that can appear in the format string for date and time formats.

Named Date Formats

The following table lists the predefined date and time format names:

Note about Usable Formats

Internally, a java.text.SimpleDateFormat is used, so its formatting syntax must be used instead of the standard MDX syntax. Using a format string that is incompatible with SimpleDateFormat’s expected syntax will result in an exception in Atoti.
Example: DATE[yyyy/MM/dd] must be used to format dates as year/month/day, even though months should be designated with a lowercase mm according to the MDX formatting standard.

Array Formats

When defining an array formatter, the format string must be enclosed by ARRAY[] (example: ARRAY['|';:10;DOUBLE[#.#]]).

Sections

A user-defined format expression for arrays can have anywhere from zero to three sections, separated by semicolons.
  • No section: the default separator is the comma, all the elements are displayed based on their toString method.
  • One section: the section defines the separator between the elements surrounded by single quotes, e.g. ’|’ or ’ - ’.
  • Two sections: the first section is for the separator, the second for the slice of elements to be displayed. The slice can be a single element, e.g 10, the first 5 elements :5, the elements starting from the 5th 5:, or a range 5:10. If not specified, the default is : which means all the elements.
  • Three sections: the first section is for the separator, the second for the slice of elements to be displayed, and the third for the formatter of each element. It could be DATE[yyyy/MM/dd] for an array of dates, or DOUBLE[#.#] for an array of doubles, or even a custom formatter.

Custom Formatters

Custom formatters can be added to Atoti by implementing the IFormatter interface. They can be useful to format Java objects that do not have formatting support by default in Atoti, or to accept a different syntax than the one specified by the MDX standard. If the custom formatter needs to be configured with a pattern string, it should implement IPatternFormatter rather than IFormatter. Similarly, the formatter can be provided the current Locale if it extends ALocalizable. In this case, the formatter should have a constructor with signature Constructor([Locale], [String]), depending on whether it extends ALocalizable and/or IFormatter. Once registered as a plugin value in the registry, the custom formatter can be used by specifying its plugin key while defining a formatter (example: PLUGIN_KEY or PLUGIN_KEY[pattern], for a custom formatter whose plugin key is PLUGIN_KEY).

Examples

Here are some examples of common format strings: