Syntax

The RECURSIVE Data-Relation option instructs the ProDataSet FILL to load self-referencing elements. That is, an element can reference a child element that already either directly or indirectly references the parent element in the hierarchy. Examples of this hierarchy are bill-of-materials tables, or organization chart manager-employee relationship tables. A ProDataSet can have no more than one recursive Data-Relation.

Here is an example of a recursive Data-Relation definition for a one-to-many relation:

DEFINE TEMP-TABLE ttEmployee NO-UNDO
  FIELD cEmployee AS CHARACTER
  FIELD cManager  AS CHARACTER
  FIELD iAge      AS INTEGER
  INDEX idxEmployee AS UNIQUE cEmployee.

DEFINE DATASET myRecurs FOR ttEmployee
  DATA-RELATION r1 FOR ttEmployee, ttEmployee
    RELATION-FIELDS (cEmployee, cManager) RECURSIVE.

Support is provided for a recursive Data-Relation during a FILL of a ProDataSet or temp-table buffer. Navigation is not supported, but can be done normally through .NET, Java, or a recursive ABL procedure.

You can check the RECURSIVE attribute of the Data-Relation handle to determine if a relation is recursive. This is the syntax for the RECURSIVE attribute:

logical-var = dataset-handle:GET-RELATION(1):RECURSIVE

If you are working with dynamic ProDataSets, an optional ADD-RELATION method parameter allows you to specify a recursive Data-Relation at run time. For more information about this method, see Create Data-Relation objects.