Format (PQL)
Formats numbers to produce text or string items with the selected display format or ‘mask’.
- Returned Output: Text
- Library: PQL \ Common \ String
- Version: 2018.00.000
- Compatibility:
- It can be combined with other PQL functions throughout the application.
- It CANNOT be used with MDX or VBA functions. But it can be used on MDX-based content in other parts of the application.
Syntax
* Click on the function’s arguments above for more details on the input values.
Comments
- The numeric value can be any element that resolves to a numeric value.
- The text mask is a prescribed input that instructs the engine on how to format the number.
- Format produces a text string. It cannot be used for subsequent numeric operations.
Different Function types
- This function is like the Excel Format function.
- Use the DateFormat function to format dates.
Masks
The syntax for describing a format mask is based on Java specifications. Details on the specification can be found here.
To facilitate the use of the masking syntax, Pyramid has exposed a variety of format mask presets in the application. The following summarizes those options:
Name | Mask | Description |
|---|---|---|
Standard | %, .<D>f | Where D is the number of decimal places. Commas are injected into the figure as needed. |
Other Standard Options | k or m | Indicates whether numbers in standard format are expressed in thousands (k) or millions (m). |
Currency | <C>%, .<D>f | Where C is the currency symbol and D is the number of decimal places. This is similar to normal numbers, except it includes details for the currency symbol. |
Percent | <D> | Where D is the number of decimal places. Unlike standard and currency formatting, the format engine multiplies the number by 100, appends a percentage sign (%) and injects commas into the figure as needed. |
Examples
Standard
This example produces 123,456.78:
This example produces 123,456:
This example produces 123,456.7
Other Standard Options
This example produces 123,456.78k:
This example produces 123.46m:
Currency
This example produces $123.44:
This example produces €123:
Percent
This example produces 12,343.6%:
This example produces 43.67%:
This example produces 44%: