Number display formats

A number display format can have up to four sections. Only the first is required. The three other sections determine how the data displays if its value is negative, zero, or NULL. The sections are separated by semi-colons:

Positive-format;negative-format;zero-format;null-format

Special characters

Table 8-2 lists characters that have special meaning in number display formats.

Table 8-2: Characters with special meaning in display formats

Character

Meaning

#

A number

0

A required number; a number will display for every 0 in the mask

Percent signs, decimal points, parentheses, and spaces display as entered in the mask.

NoteUse at least one 0 In general, a number display format should include at least one 0. If you enter 0 in a field with the mask ###, the field will appear to be blank if you do not provide a zero-format section. If the mask is ###.##, only the period displays. If you want two decimal places to display even if both are 0, use the mask ##0.00.

Number keywords

You can use the following keywords as number display formats when you want InfoMaker to determine an appropriate format to use:

Note that [Currency(7)] and [Currency(n)] are legal edit masks, but they are not legal display formats.

Percentages

Use caution when defining an edit mask for a percentage. When you enter a number in a column with a percent edit mask and tab off the column, InfoMaker divides the number by 100 and stores the result in the buffer. For example, if you enter 23, InfoMaker passes .23 to the buffer. When you retrieve from the database, InfoMaker multiplies the number by 100 and, if the mask is ##0%, displays 23%.

The datatype for the column must be numeric or decimal to handle the result of a division by 100. If the column has an integer datatype, a percentage entered as 333 is retrieved from the database as 300, and 33 is retrieved as 0.

If you use an edit mask with decimals, such as ##0.00%, the datatype must have enough decimal places to handle the division. For example, if you enter 33.33, the datatype for the column must have at least four decimal places because the result of the division is .3333. If the datatype has only three decimal places, the percentage is retrieved as 33.30.

Examples

Table 8-3 shows how the values 5, –5, and .5 display when different format masks are applied.

Table 8-3: Number display format examples

Format

5

-5

.5

[General]

5

-5

0.5

0

5

-5

1

0.00

5.00

-5.00

0.50

#,##0

5

-5

1

#,##0.00

5.00

-5.00

0.50

$#,##0;($#,##0)

$5

($5)

$1

$#,##0;-$#,##0

$5

-$5

$1

$#,##0;[RED]($#,##0)

$5

($5)

$1

[Currency]

$5.00

($5.00)

$0.50

$#,##0.00;($#,##0.00)

$5.00

($5.00)

$0.50

$#,##0.00;[RED]($#,##0.00)

$5.00

($5.00)

$0.50

##0%

500%

-500%

50%

##0.00%

500.00%

-500.00%

50.00%

0.00E+00

5.00E+00

-5.00E+00

5.00E-01