xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

DbRSelect()

Returns the child work area number of a relation.

Syntax

DbRSelect( <nRelation> ) --> nWorkArea

Arguments

<nRelation>
The parameter is a numeric value indicating the ordinal position in the list of relations to retrieve the child work area number. Relations are numbered in the sequence they are defined, beginning with 1.

Return

The function returns as a numeric value the work area number of the relation specified with <nRelation>. The return value is zero if no relation is defined.

Description

The function DbRSelect() determines the work area number of a child work area, the current work area is related to. It determines it from the ordinal position of a relation which is numbered according to the sequence a relation is defined with the SET RELATION command.

DbRSelect() is used in conjunction with DbRelation() which retrieves the relation expression of a relation. Pass the return value of DbRSelect() to Alias() to find out the alias name of the child work area.

Info

See also:DbFilter(), DbRelation(), DbSetRelation(), OrdSetRelation(), SET RELATION
Category: Database functions
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example opens three databases and defines two relations.
// The result of various DbRSelect() calls is shown.

   PROCEDURE Main
      USE Order ALIAS Ord NEW

      USE Parts ALIAS Part NEW EXCLUSIVE
      INDEX ON PartNo TO PartNo

      USE Customer ALIAS Cust NEW EXCLUSIVE
      INDEX ON CustNo TO CustNo

      SELECT Ord
      SET RELATION TO CustNo INTO Cust, ;
                   TO PartNo INTO Part

      ? Alias()                     // result: ORD
      ? DbRSelect(1)                // result: 3
      ? DbRSelect(2)                // result: 2
      ? Alias(DbRSelect(1))         // result: CUST
      ? Alias(DbRSelect(2))         // result: PART

      SELECT Part
      ? Alias()                     // result: PART
      ? DbRSelect(1)                // result: 0

      CLOSE ALL
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe