Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>set relation</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
SET RELATION


Syntax:     SET RELATION [ADDITIVE] TO [<key exp1>/<expN1> INTO
            <alias1>/(<expC1>)] [,TO <key exp2>/<expN2> INTO
            <alias2>/(<expC2>)]...

Purpose:    To relate two work areas using a key expression, record
            number, or numeric expression.

Arguments:  <key exp> is an expression used to perform a SEEK in the
            child work area each time the record pointer moves in the
            parent work area.  For this to work, the child work area
            must have an index in USE.

            <expN> is an expression used to perform a GOTO to the
            matching record number in the child work area each time the
            record pointer moves in the parent work area.  If <expN>
            evaluates to RECNO(), the relation uses the parent record
            number to perform a GOTO to the same record number in the
            child work area.  For a numeric expression type of relation
            to execute correctly, the child work area must not have an
            index in USE.

            <alias> identifies the child work area.

            SET RELATION TO with no arguments releases all relations
            defined in the current work area.

            Clipper supports eight relations per work area.  Note that
            cyclical relations are not supported.  You cannot relate a
            database file either directly, or indirectly, to itself.

Option:     Additive: The ADDITIVE clause adds the specified child
            relations to the relations already set in the current work
            area.  If this clause is not specified, existing relations
            in the current work area are released before the newly
            specified child relations are set.

Usage:      A relation defined by SET RELATION causes the record pointer
            to move in the child work area in accordance with the
            movement of the record pointer in the parent work area.  If
            there is not a match in the child work area, the child
            record pointer is positioned to LASTREC() + 1, EOF() returns
            true (.T.), and FOUND() returns false (.F.).

            Note: A SET RELATION seek in a child work area does not
            obey SOFTSEEK and always behaves as if SOFTSEEK is OFF.  If
            a match is not found in the child work area, the child
            record pointer is positioned to LASTREC() + 1.

Library:    CLIPPER.LIB


----------------------------------- Examples -------------------------------

   The following example relates three work areas in a multiple
   parent-child configuration with Customer related to both Invoices and
   Zip.

   SELECT 0
   base_area = SELECT()

   SELECT (base_area + 1)
   USE Invoices INDEX Invoices

   SELECT (base_area + 2)
   USE Zip INDEX Zipcode

   SELECT (base_area)
   USE Customer

   SET RELATION TO Customer INTO Invoices,;
                TO Zipcode  INTO Zip

   LIST Customer, Street, Zip->City, Invoices->Number, Invoices->Amount


   Sometime later, you can add a new child relation using the ADDITIVE
   clause, like this:

   SELECT 0
   USE BackOrder INDEX BackOrder
   SELECT Customer

   SET RELATION ADDITIVE TO Cust_num INTO BackOrder


See Also: SET INDEX SET ORDER USE DBRELATION() DBRSELECT()

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