Variables Used in Forms

You can use global variables (both user-defined and QMF-supplied) and form variables in QMF forms. A variable can replace a string of text or a numeric value. You can assign different values to the variable to produce different reports without changing the form.

Single or double quotation marks do not affect variables used in the form.

Global variables in forms make it possible for multiple queries to share the same form. For example, using the SET GLOBAL command, you can set a string of text such as Annual Report for 1993 to a variable &ann and use it in a form. (See SET GLOBAL.) You can use the SHOW GLOBAL command to display some or all of the global variables available.

Normally, QMF removes trailing blanks from character values for substitution variables. For numeric values, leading blanks are removed. To retain leading or trailing blanks in substitution variables in the report, append _B to any variable on a form panel. For example: &3_B. This special syntax is meaningful only for substitution variables in the form panels. It does not apply to substitution variables used in queries or procedures, or to the variables &ROW, &DATE, &TIME, and &PAGE.

QMF supplies variables called form variables that return system information or information about your report. The form variables are:

&ROW &COUNT &DATE &CALCid
&TIME &n &PAGE &an

These variables are defined in the context of the form panel they are entered on and where they appear in the report. They are discussed (if applicable) in the individual sections for each form panel.

Table 19 shows which variables are allowed on the various form panels.

Table 19. Variables Allowed on Form Panels
F.PAGE F.BREAKn F.CALC F.COLUMNS F.CONDITIONS F.DETAIL F.FINAL
Head Foot Head Foot Column Definition Head Block
&ROW x x x x x x x x x x
&DATE x x x x x x x x x x
&TIME x x x x x x x x x x
&PAGE x x x x x x x x
&COUNT x x x x
&CALCid x x x
&n x x x x x x x x x x
&an x x x x
Global variables x x x x x x x x x x
[ Previous Page | Next Page | Contents | Index ]