Progress
Results User’s Guide
for UNIX


Querying for Records

This section describes how to use the Query option to generate a subset of records from a file. This option lets you quickly build simple WHERE clauses, called queries, where you compare one value for each field, and each comparison is joined by AND. (With the Where option, you build WHERE clauses that can compare many values to one field, and you join comparisons using AND or OR.)

For example, you can perform queries to select subsets of records:

When you use the Query option, a record must meet each criteria for it to be in the subset.

Follow these steps to use the Query option to generate a subset of records from a file:

  1. Select the Query option.
  2. A form appears where there are no field values. The comparison line shows the comparison for the field that has the cursor next to it.

    In this example, the comparison line shows the default comparison for Cust-Num Equals whatever value you enter. You can change the comparison by entering one of the symbols in Table 4–2.

    Table 4–2: List of Comparison Operators
    Symbol
    Comparison Meaning
    =
    Equals, or begins (for character)
    >
    Greater than
    <
    Less than
    <=
    Less than or equal to
    #
    Not equal to
    &
    Begins (character only)
    ?
    Matches pattern (character only) (*= matches any number of characters, .= matches any one character)
    ~
    Next character entered literally

    Use a tilde (~) when you want Results to interpret a comparison symbol as a character. For example, use this symbol if you want to query for a customer with the name “Jack & Jill”. Since the system usually interprets the ampersand (&) as meaning “Begins with”, enter the tilde before the ampersand so Results interprets the ampersand as a character, not an operator. In this example, you would type: Jack ~& Jill.

  3. Press HELP to display a list similar to Table 4–2 on your screen, then press END or INSERT LINE to clear it from your screen.
  4. Move the cursor to the field you want to query. For example, if you want to find customers whose names begin with b, move the cursor to the Name field and enter b.
  5. The comparison line updates to the following.

    If you want to reset all the Query criteria and start again, press INSERT LINE to remove all the existing criteria, then enter the new criteria you want.

  6. Enter the comparison operator you want, depending on the value you want to query. For example, if you want to query for customer numbers greater than 25, type the greater than (>) operator in the Cust-Num field.
  7. The comparison line changes to include the operator you enter.

  8. Enter the value you want to compare the field to and press RETURN.
  9. Press GO to get the subset of records that are true for this comparison, or add a comparison for another field. In this example, you add an additional comparison.

  10. Press RETURN until the cursor is in the field you want to add to the query.
  11. When the cursor is in the correct field, use the default comparison (equals) or change it.

  12. Type the value you want to compare with the field. You can continue to build the criteria, or you can press GO to get the subset of records that meet the current criteria.
  13. The first record that meets the criteria appears in a subset form. For example, if you query for customers where the customer’s state equals Massachusetts and the customer number is greater than 10, you would see this window.

    The title at the top of the customer form tells you that this is a subset of the customer file. Thus, when you do a browse of this set, you see the subset of records that meet the criteria. In this case, you see the customers where customer number is greater than 10 and state equals Massachusetts.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095