Construct a query condition through a series of menus
[AT <expN1> [TO <expN2>]]
[HELPFILE <.hlp filename> | (<expC2>)]
The MENU QUERY command displays a series of four menus with a top line at the specified row <expN1>. The optional AT clause is used to specify the beginning row of the display. The menu query display starts on row 2 by default. The maximum row number for the AT clause is 9 for 24 line terminals, and 10 for 25 line terminals. The TO <expN2> clause is used to specify an ending row number for the FIELDS MENU. The height of the FIELDS MENU will adjust to row numbers specified with the AT and TO clauses.
The four menus displayed are the FIELDS MENU, the OPERATOR MENU, the CONNECTOR MENU, and the QUERY FILES MENU. Selections from these menus construct a query condition for the active table. When the menus display, the FIELDS MENU is automatically activated.
The FIELDS MENU contains fields from the active table. Selections from this menu provide the query condition with a specific field to select certain records from the table. If the SET DESCRIPTION command is set to ON, field descriptions are listed within the menu instead of field names. The currently selected field name, type and width are displayed above the field descriptions. When SET DESCRIPTIONS is set to OFF, the reverse is true: the currently selected field description is displayed above the menu of field names, types, and widths. After you have selected a field, the OPERATOR MENU is activated to allow specification of a value for that field.
The OPERATOR MENU contains operators with which to limit record selection by specifying a field value. After an operator is selected from this menu, a dialog box appears requesting a field value. Pressing the [HELP] key from this dialog box displays a pop-up choice list of field values from the currently active table. Character field values are automatically converted to upper case and enclosed in quotation marks.
The OPERATOR MENU also accepts specification of a character field name rather than a field value. When a field name is entered, the query condition compares the value of the field selected from the FIELDS MENU, and the value of the field name entered in the dialog box. The MENU QUERY command will only compare the values of two character fields.
The CONNECTOR MENU allows you to either mark the end of the query, or add another condition. If anything other than <End of query> is selected, the cursor returns to the FIELDS MENU.
The QUERY FILES MENU allows you to either save the current query condition to a file, or load an existing query file. The QUERY FILES MENU is accessed by pressing the [MENUBAR] key. Query file names have an extension of ".qry".
|BOLD||The menu frame is highlighted.|
|CLEAR||The inside of the menu frame is cleared before displaying the menu.|
|COMMAND <expC1>||The action line (line 22) is updated with the query condition as it is being constructed. The expression <expC1> displays at the beginning of the query condition. <expC1> should include a blank space at the end to separate the command from the query condition.|
|HELPFILE <.hlp>||A helpful text file can be associated with the menu. The <.hlp filename> will be displayed in a read-only window for viewing when the [HELP] key is pressed. The window will be labeled "Operating instructions." The file name can be substituted with a <expC2>, enclosed in round brackets, which returns a valid filename. If no file extension is specified, then ".hlp" is assumed. The command, INSTRUCT, must be set ON when using this option.|
|OFF||The display of messages in the message line is disabled.|
|POPUP||The screen is automatically saved when the menu is displayed, and restored when the menu is cleared.|
|SCREENMAP||The screen is handled as if SCREENMAP is ON even when it is OFF.|
Menu items can be selected by entering the item's first character. The following keys are active in the MENU QUERY:
|[PAGE DOWN]||Display next page of fields when in the FIELDS MENU|
|[PAGE UP]||Display previous page of fields when in the FIELDS MENU|
|[CURSOR UP]||Skip to previous menu item|
|[CUSROR DOWN]||Skip to next menu item|
|[CURSOR LEFT]||If in the FIELDS MENU, then skip to previous workarea|
|[CURSOR RIGHT]||If in the FIELDS MENU, then skip to next workarea|
|[RETURN]||Select a menu item|
|[ABANDON]||Discard query and exit|
|[EXIT/SAVE]||Exit with constructed query|
Any character entered in response to a prompt will normally be converted to upper case and quotation marks will be added automatically at the start and end of the string. To enter a query that is case sensitive and contains lower case characters, it is necessary to enclose the string with quotation marks ("").
On exit from MENU QUERY, the MENUITEM() function will return the correctly constructed query condition as a character string. If the [ABANDON] key was pressed, or no query was constructed, then MENUITEM() will return a null string and MENU() will return –1.
menu query command "REPORT FOR" store menuitem() to query if not empty(query) query = "FOR " + query endif report form patrons &query to print