Skip to main content
Previous section   Next section

$MVFMTS

A MultiValue formatting function for dynamic array elements.

Synopsis

$MVFMTS(dynarray,format)

Arguments

Argument Description
dynarray A MultiValue dynamic array to be formatted for display.
format A quoted string consisting of positional letter and number codes specifying the display format for the elements of dynarray.

Description

The $MVFMTS function returns the dynarray value with each element formatted as specified by format. This formatting may include justification, character filling, and the rounding or zero padding of numeric element values. The most common use for $MVFMTS is to provide a uniform display format for fractional numbers.

The format string has the following format:

wfRn
w Optional — The overall width of the display field, specified as a positive integer. Used to impose a uniform width (number of characters) for each element of dynarray. Different operations are performed if w is larger or smaller than the length of an element, as described in the $MVFMT function.
f Optional — A fill character, specified as a single character. If the fill character is a number, the backslash (\), or the letters “L”, “R”, or “T” it must be enclosed in string delimiter quotes. You must specify w to use f. If you specify w, but do not specify f, it defaults to the space character.
R Optional — The letter “R” or “L” specifying right or left justification. This letter code is not case-sensitive. If you do not specify a letter code, $MVFMTS defaults to left justification.
n Optional — The number of fractional digits to the right of the decimal place, specified as a positive integer. If you specify n, it must either be the only code in format, or it must be preceded by the letter “R” or “L”. If you do not specify n, $MVFMTS defaults to number of fractional digits in string.

There are two basic uses of format:

  • To return fractional numbers in a standard form. $MVFMTS can be used to round a fractional number to an integer or to a specified number of fractional digits. If the specified number of fractional digits is larger than the number of fractional digits in the element value, $MVFMTS zero pads the additional digits.

  • To return strings in a standard form. $MVFMTS can left justify or right justify a string and add a fill character before or after to make each element contain the same number of characters.

For further details on format codes, refer to the $MVFMT function.

See Also

  • $MVFMT function

  • The MultiValue Basic FMTS function, as described in the Caché MVBasic Reference