Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.3 . Guide To CA-Clipper - <b>dbrelation()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DBRELATION()
 Return the linking expression of a specified relation
------------------------------------------------------------------------------
 Syntax

     DBRELATION(<nRelation>) --> cLinkExp

 Arguments

     <nRelation> is the position of the desired relation in the list of
     current work area relations.  The relations are numbered according to
     the order in which they were defined with SET RELATION.

 Returns

     DBRELATION() returns a character string containing the linking
     expression of the relation specified by <nRelation>.  If there is no
     RELATION SET for <nRelation>, DBRELATION() returns a null string ("").

 Description

     DBRELATION() is a database function used with DBRSELECT() to determine
     the linking expression and work area of an existing relation created
     with the SET RELATION command.

     DBRELATION() returns the linking expression defined by the TO clause.
     DBRSELECT() returns the work area linked as defined by the INTO clause.

     By default, DBRELATION() operates on the currently selected work area.
     It will operate on an unselected work area if you specify it as part of
     an aliased expression (see example below).

 Notes

     .  Declared variables: A character string returned by
        DBRELATION() may not operate correctly when recompiled and executed
        using the macro operator (&) if the original expression contained
        references to local or static variables, or otherwise depends on
        compile-time declarations.

 Examples

     .  This example opens three database files, sets two child
        relations from the parent work area, and then displays the linking
        expression to the second child work area:

        USE Invoices INDEX Invoices NEW
        USE BackOrder INDEX BackOrder NEW
        USE Customer INDEX Customer NEW
        SET RELATION TO CustNum INTO Invoices, OrderNum ;
              INTO BackOrder
        //
        ? DBRELATION(2)                  // Result: OrderNum

     .  Later you can query the same linking expression from an
        unselected work area by using an aliased expression like this:

        USE Archive NEW
        ? Customer->(DBRELATION(2))   // Result: OrderNum

     .  This example is a user-defined function, Relation(), that
        returns the results of both DBRELATION() and DBRSELECT() as an array:

        FUNCTION Relation( nRelation )
           RETURN { DBRELATION(nRelation), ;
                 ALIAS(DBRSELECT(nRelation)) }

 Files   Library is CLIPPER.LIB.


See Also: DBFILTER() DBRSELECT() SET RELATION

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