Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Grumpfish Library 3.2 - <b>setfilt</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
SETFILT

    This powerful utility allows you to create and save complex queries
    (filters) for any database file.  All you need to do is have a
    database file open before calling this routine.  To use it, simply
    include the following line of code in your program:

    SETFILT()

    You should follow this line with any necessary output commands
    (e.g., DISPLAY, LIST, REPORT FORM, etcetera).

    The queries are stored in the files QUERIES.DBF and QUERIES.DBT.
    These files will be created automatically if they don't already
    exist.

    Viewing and Selecting a Query

    When you enter the query builder, you will get a window containing
    descriptions of all available queries, along with the database
    aliases to which they correspond.  The alias is stored along with
    the query criteria to preclude obvious crashes.  For example, if you
    built a query such as "LNAME equals Smith    and attempted to run
    this on a database that did not have the field LNAME, you can guess
    what would happen.

    Available Options

    Up Arrow    Move highlight bar up one query
    Down Arrow  Move highlight bar down one query
    F7          Count records matching current query
    F8          Delete current query
    F9          View criteria for current query
    F10         Create a new query
    Enter       Run current query
    Esc         Exit the query module

    Press F7 to count the records that match the criteria for the
    highlighted query.  This may take a few moments for large files
    because the program must scan the entire database.  If the database
    that you had in use before calling SETFILT does not correspond to
    the highlighted query, you will get an error message to that effect.

    Press F8 to delete the highlighted query. You will be asked to
    confirm your request. Please note that this option will physically
    delete the query and pack the memo files as well, rather than simply
    marking the record for deletion.

    Pressing F9 will pop up a window showing the criteria for the
    highlighted query.  You may use the up and down arrow keys to scroll
    through the criteria.  Press Esc to return to the query window.

    Pressing Enter will run the query on your database file.  If no
    records fit the criteria, you will receive a message to that effect.
    As with the count function, the selected query must match the
    database that you had in use before calling SETFILT.

    Creating a New Query

    A) Viewing Field Names and Descriptions

    Pressing F10 from the query window will bring up the criteria
    screen.  A scrolling window containing the field names of the
    selected database will appear on the right side of the screen.

    The following commands are available:

    Enter          Select current field
    Up Arrow       Move highlight bar up
    Down Arrow     Move highlight bar down
    Letters (A-Z)  Move highlight bar to the next field that begins
                   with that letter

    If you attempt to move past the first or last query description, you
    will get a reminder tone.

    B) Selecting an Operator

    Pressing Enter will bring up the operators window, which contains
    the following choices:

    a) Equal to
    b) Less than
    c) Greater than
    d) Less than or equal to
    e) Greater than or equal to
    f) Not equal to
    g) Contains
    h) Sounds like

    Use the up and down arrow to select the desired operator, then press
    Enter to continue.  Note: if the selected field is logical type, the
    operators window will be bypassed.

    C) Selecting a Value

    When you have selected an operator, another window will appear
    beneath the operators window.  This window will contain the field
    name and the operator.  Type in the desired value for this field,
    then press Enter to continue.

    If you wish to see all of the available values in your database, you
    may press Alt-V to pop up a scrolling window of values.  You may
    select one of these as the value for your query by highlighting it
    and pressing Enter, or you may press Esc to exit without selecting
    anything.

    D) Selecting a Boolean Operator

    When you have entered the value, another window will appear below
    the value window. This window will contain the following choices:

    a) 'Discard'
    b) ' .AND. '
    c) ' .OR. '
    d) ' .AND. ('
    e) ' .OR. ('
    f) ') .AND. '
    g) ') .OR. '
    h) '<done>'

    Move the highlight bar to the desired selection and press Enter.
    You will note that options f) and g) will be unavailable to you
    until you already have embedded an open parenthesis in your
    criteria.

    E) Ending the Query

    When you have finished building the criteria for this query, select
    '<done>' from the Boolean operator window.  You will then be asked
    to enter a description for this query for future reference.  This
    description may contain up to 50 characters.  Press Enter when you
    are finished entering the description, and you will be returned to
    the query window.  If you want to exit without saving this query,
    press Esc.

    If you wish to run this query immediately without saving it for
    future use, simply leave the description empty and press Enter.

    Sample Usage

    USE customer                    
    DO SETFILT                      
    DISPLAY ALL fname, lname, custno

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson