Skip to main content

Specifying a Format String

Specifying a Format String

Note:

For date measures, see the next section.

The Format string option enables you to specify the display format for the data. You can override this formatting in the Analyzer (or in manually written MDX queries). To specify the formatting for a measure in the Architect, do the following while the measure is displayed:

  1. Click the Find button .

    The system displays a dialog box that includes the following fields:

    Format String screen in Architect, showing how to enter Format String and Color for four so-called Pieces.

    Here:

    • Positive piece specifies the format to use for positive values.

    • Negative piece specifies the format to use for negative values.

    • Zero piece specifies the format to use for zero.

    • Missing piece specifies the format to use for missing values; this is not currently used.

    In each of these, Format string specifies the numeric format, and Color specifies the color.

    The details are different for date-type measures; see the next section.

  2. Specify values as needed (see the details after these steps).

  3. Click OK.

Format String Field

The Format string field is a string that includes one of the following base units:

Base Unit Meaning Example
# Display the value without the thousands separator. Do not include any decimal places. 12345
#,# Display the value with the thousands separator. Do not include any decimal places. This is the default display format for positive numbers. 12,345
#.## Display the value without the thousands separator. Include two decimal places (or one decimal place for each pound sign after the period). Specify as many pound signs after the period as you need. 12345.67
#,#.## Display the value with the thousands separator. Include two decimal places (or one decimal place for each pound sign after the period). Specify as many pound signs after the period as you need. 12,345.67
%time% Display the value in the format hh:mm:ss, assuming that the value indicates the number of seconds. This is useful for measures that display time durations. 00:05:32

Note that InterSystems IRIS displays the thousands separator and the decimal separator as determined by the server locale (see Using the Locale to Control the Names of Time Members.). The locale, however, does not affect the syntax shown in the first column of the preceding table.

You can include additional characters before or after the base unit.

  • If you include a percent sign (%), the system displays the value as a percentage. That is, it multiplies the value by 100 and it displays the percent sign (%) in the position you specify.

  • Any other characters are displayed as given, in the position you specify.

The following table shows some examples:

Example formatString Logical Value Display Value
formatString="#,#;(#,#);"

Note that this corresponds to the default way in which numbers are displayed.

6608.9431 6,609
–1,234 (1,234)
formatString="#,#.###;" 6608.9431 6,608.943
formatString="#%;" 6 600%
formatString="$#,#;($#,#);" 2195765 $2,195,765
–3407228 ($3,407,228)

Color Piece

For the Color field, specify either of the following:

FeedbackOpens in a new tab