Fields - format¶
A format is a template which maps precisely the number of characters of a numeric field to be displayed, printed and input, and their type and position. The format string must be enclosed in double quotes.
If no format is provided, a standard default for the field type and size is applied. The use of two consecutive commas at this position (with or without intervening white space) indicates that no format is being specified. It is essential that this be done if flags and/or validation are to be specified. See Numeric format defaults.
Assigning or retrieving a format at runtime¶
A field format may be assigned at run time by the command:
field_id->format = text_expression
Note that if the field is linked to a textbox for display on the screen, the field format may be assigned by use of the textbox format = clause. This defaults to the field format. The textbox format may similarly be changed at run time:
box_id->format = text_expression
The form field_id->format can also be used to retrieve a field format.
In a !report section, a convenient place to place a field_id->format command is within the !init section of the report. Additionally, in a !report section, the print[h] command may be assigned a format to be used in that specific print statement, as in the following example. The default remains unchanged.
print sp.total: “####0.00”
RELATED TOPICS |