Query Instructions The Query program will allow you to produce a report based on your selection, sorting and formatting specifications. Upon entry, you will be presented with a data dictionary and string gadgets for entering your record selection criteria, sort sequence and output report format. The data dictionary presents you with a list of data names that can be used to display or print values contained in the Reference database. The Select string gadget will allow you to specify some selection criteria to be used to determine which reference entries will be included in you output display or report. For example, SELECT: (Subject = "graphics" or "music") and Date = "July" specifies that the database is to be searched for any Subject that contains the words "graphics" or "music" that also has a Date of "July". Remember that in order to enter data into a string gadget you must first position the pointer within the gadget and depress the left button on the mouse. Note that the Select parameters contain parentheses to prevent ambiguities. If there is a possibility that the key word or phrase you are looking for contains occurrences with both upper and lower case letters, you must check for both, e.g., "Graphics" or "graphics". Another method is to use the wild character, e.g., "?raphics". The Sort string gadget will allow you to specify the sequence in which the selected records are to be displayed or printed. For example, SORT: Title specifies that the selected reference entries are to be sorted in title sequence. Only one sort field may be entered. The Report string gadget will allow you to specify the format of the output display or report. For example, REPORT: Subject, col 20, Title, col 60, Date specifies that the Subject, Title and Date for the selected records are to be displayed. Further, it is specified that the Title is to be displayed beginning in column 20 and that the Date is to be displayed beginning in column 60. The Report specification parameters may be very simple or very complex depending upon the skill of the user. The Report specification parameters can be classified as either describing "when to do it" or "what to do". When To Do It: page_top - specifies that the following functions are to be executed at the top each printed page or screen. page_bottom - specifies that the following functions are to the executed at the bottom of each printed page or screen. top() - specifies that the following functions are to be executed after there has been a change in the content of . For example, top(Author). Normally, the specified data-name will be the same as the sort sequence. bottom() - specifies that the following functions are to be executed before there is a change in the content of data-name. For example, bottom(Subject). detail - specifies that the following functions are to be executed for each selected reference entry. What To Do: print - specifies that all output is to be routed to the printer. display - specifies that all output is to be routed to the screen. "Display" is the output default. - causes the specified data name to be printed or displayed. For example, Subject is a data-name. "literal" - causes the specified literal to be printed or displayed. For example, "The result is:" is a literal. col nn - causes the following data item to be displayed or printed in the column specified by nn. skip n - causes n lines to be skipped before displaying or printing the next data item. If n is not provided, 1 is assumed. pause - causes a pause in the output process until a key (any key) is depressed. eject - if "print" has been specified, this command causes the paper to be ejected to the top of the next page; otherwise, the screen will be cleared. Here is an example of a more complex query construction: SELECT: (Title = "Microsoft" and Subject = "basic") or Publication = "Byte" SORT: Author REPORT: top(Author) Author detail col 20 Subject skip col 20 Title skip 2 Rules: (1) The Select statement may contain these operators: = Equal to <> Unequal to < Less than > Greater than <= Less than or equal to >= Greater than or equal to (2) The field on the left side of the operator must be a data name from the dictionary. (3) The field on the right side of the operator may be either a data name or literal. Literals must be enclosed in double quotes. (4) In the case of equal and unequal, the data name on the left side of the operator is searched for any occurrences of the data specified on the right of the operator. (5) The length of the item to the right of the operator may not be greater than the length of the item to the left of the operator. (6) When used in a literal, the "?" is wild. For example, to select all records in the database enter: SELECT: Subject = "?" (7) Commas may used to improve readability; otherwise, they serve no useful purpose. (8) All data names must be capitalized. All other commands must be in lower case. If your printer carriage is 80 columns in width, try setting your printer preferences for compressed mode in order to print reports that are greater than 80 characters in width.