Using QMF

Adding a CONDITIONS box

You can express simple conditions in an example table. However, more complicated conditions require the use of example elements and a CONDITIONS box. You can also specify expressions in an example table, as is shown in Adding conditions to the example table. However, it is generally more convenient to define example elements in the example table and specify the expressions in a CONDITIONS box.

To add a CONDITIONS box to your query, enter this command:

COMMAND===> DRAW COND

Note:
If you enter DRAW CONDITION or DRAW CONDITIONS instead, an example table of that name rather than a CONDITIONS box displays.

Use a CONDITIONS box to do any of the following:

The CONDITIONS box in the following query uses the example elements (_S and _C) defined in the example table to select rows where salary plus commission (_S + _C) is greater than $20,000.

When you run this query:



Q.STAFF | NAME | SALARY | COMM |
--------+------+--------+------|
P.      |AO.   | _S     | _C   |
 
|        CONDITIONS           |
|-----------------------------|
| _S + _C > 20000             |

QMF produces this report:

NAME          SALARY      COMM
----------  --------  --------
GRAHAM      21000.00    200.30
WILLIAMS    19456.50    637.65

QMF presents the names in ascending order (AO.). (The result does not include anyone whose salary alone is greater than $20,000 if the commission is null.)

This query selects anyone whose weekly salary is less than $300.



Q.STAFF | ID | NAME | DEPT | JOB | YEARS | SALARY | COMM |
--------+----+------+------+-----+-------+--------+------|
P.      |    |      |      |     |       | _SAL   |      |
 
|        CONDITIONS           |
|-----------------------------|
| _SAL/52 < 300               |

This query selects anyone whose commission is 5% or more of total earnings.



Q.STAFF | ID | NAME | DEPT | JOB | YEARS | SALARY | COMM |
--------+----+------+------+-----+-------+--------+------|
P.      |    |      |      |     |       | _S     | _C   |
 
|        CONDITIONS           |
|-----------------------------|
| _C >= .05 * (_S+_C)         |

You can use more than one CONDITIONS box or more than one condition in any box. However, you must place each condition on a single row in a box.

Multiple conditions in a query are implicitly connected by "and". That is, in the example below, the AND keyword is assumed between the two conditions _Y = 10 OR _S > 20000 and _C >= 1000. QMF evaluates the OR condition (_Y = 10 OR _S > 20000) before it connects and evaluates the two conditions. (See Order of evaluation: for information on determining processing order.)



Q.STAFF | ID | NAME | DEPT | JOB | YEARS | SALARY   | COMM |
--------+----+------+------+-----+-------+----------+------|
P.      |    |      |      |     | _Y    | _S       | _C   |
 
|        CONDITIONS           |
|-----------------------------|
| _Y = 10 OR _S > 20000       |
 
|        CONDITIONS           |
|-----------------------------|
| _C <= 1000                  |


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]