Return the linking expression of a specified relation

     DBRELATION(<nRelation>) --> cLinkExp


     <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.


     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 ("").


     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).


     .  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.


     .  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.


One response to “C5_DBRELATION

  1. Pingback: C5_SET RELATION | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.