API reference
Table of contents


getFormat(measureName: String, aggregation: String): FormatObject

[starting from version: 1.4]

Returns the default number format or the number format for the specified measure.

The number format can be defined in a report or using the setFormat() method. Each measure has only one format but a format can be applied to more than one measure. Learn more in this guide: Number formatting.


If getFormat() is called without parameters, the default number format is returned.

To get the number format of a specific measure, specify the following parameters:

  • measureName — String. The measure's unique name. Must be used with the aggregation property unless the measure is calculated.
  • aggregation optional — String. The measure’s aggregation. If the measure is calculated, skip the aggregation property.


1) How to get a precision of the default number format:

let format = flexmonster.getFormat();
alert("Precision: " + format.decimalPlaces);

Try on JSFiddle.

2) How to change a currency symbol for a specific measure:

let format = flexmonster.getFormat("Price", "sum");
format.currencySymbol = "$";
//format.currencySymbol = "£" // pound sterling
//format.currencySymbol = "€" // euro
//format.currencySymbol = "¥" // yen
flexmonster.setFormat(format, "Price", "sum");

Open the example on JSFiddle.

See also

Number formatting guide