There are two logical connectives that may be used in INFO/ACCESS queries to form compound selection expressions: AND and OR. These connectives correspond to the Boolean operators by the same names. Logical connectives are very useful for defining complex selection criteria.
The AND connective specifies that all of the specified criteria must be met if an item is to be included in the report. For example, the following query includes three different selection criteria:
>LIST ORDERS WITH DATE "11/11/87" WITH TOTAL.AMT > "100" AND WITH CUST# > "330" |
All three of the following conditions must be met for each order item to be selected:
An order date of November 11, 1987
An order amount of more than $100.00
A customer number higher than 330
The report will contain the item-IDs of only those items in the ORDERS file that meet all three conditions. An INFO/ACCESS query may include up to nine AND phrases.
The OR connective specifies that at least one of the specified criteria must be met if an item is to be included in the report. For example:
>LIST ORDERS WITH DATE "11/11/87" OR WITH TOTAL.AMT > "100" OR WITH CUST# > "330" |
The preceding query produces a report quite different from the one that uses the AND connective. It selects the following items:
All orders taken on November 11, 1987
All orders taken on any date for an amount greater than $100.00
All orders taken for all customers whose ID numbers are greater than 330
If no logical connective is used in a compound selection expression, the system assumes OR. An INFO/ACCESS query may include any number of OR phrases.
If more than one logical connective is used in a query, the selection criteria are evaluated from left to right.
For example, assume the user wants to display the item for a certain customer whose last name is SMITH, who may or may not live in Massachusetts or Maine; the town’s name may be ROCKPORT. Type:
>LIST CUSTOMERS WITH LAST-NAME "SMITH" AND WITH CITY "ROCKPORT" AND WITH STATE "MA" OR "ME" |
This query generates a list of all customers whose last name is SMITH, who live in a city called ROCKPORT, and who live in Massachusetts or Maine.
See Also