FORMAT - Format a numeric into a string (Reports & Settings Report Generator function)
From Catalyst
Syntax
$FORMAT{num, format, currency, length}
Description
Will take a number num and format it into a string with currency symbol, signs, blank when zeros, etc.
Parameters
- num
- A numeric parameter that can not be omitted.
- The value to format. Can be any expression that results in a numeric value.
- format
- A text parameter that can not be omitted.
- The format string can contain any of the following formatting characters:
- -
- The number is signed and if less than zero a "-" will be added to the front of the output.
- $
- (or £) The field is a currency field and a currency symbol will be included in the output. See parameters currency and length below.
- 99.9
- Indicate the number of digits to allow before and after the decimal point. Note - the maximum value before the point is 12 and after the point is 6. eg. 6.2 would allow for six digits before the point and 2 after.
- Z
- Blank when zero. If the value is zero the resulting output will be completely blank.
- B
- Blank before decimal point. All leading zeroes will be blanked.
- A
- Blank after decimal point. All trailing zeroes will be blanked.
- currency
- A text parameter that can be omitted.
- This parameter is only used when $ or £ is used in the format string. By default, the currency symbol for the system base currency is included in the output. To have the currency symbol for a different currency used instead, the currency code for that currency should be used here (eg. 'USD' for dollars).
- length
- A numeric parameter that can be omitted (it defaults to "1").
- 0-3
- This parameter is only used when $ or £ is used in the format string. By default, room is made for a single character currency symbol in the output. However, currency symbols in Platinum may now be up to 3 characters in size. This parameter can be used to specify the maximum number of characters of a currency symbol to include in the output. A zero here would in effect cancel out the $ above and no currency formatting would occur.
Returns
A text value. Formatted string.