Processing Rows in Child Collections

This document provides information on how to process rows in a child collection. The process described below demonstrates how to set the attribute of a property on all the rows of a child class.

The code to process rows in a child collection should go under the "CURPTH" class path for the corresponding child collection, rather than under the main class.

Example:

  • If the class path is the child class (CURPTH = "[child class]"), the Supervisor executes these events once per collection row:

        $METHODS
          Case CURPTH
            When "[child class]"
              Case ACTION
                When "AREAD_AFTER"
                  Gosub ACTIVATE_FIELDS
              Endcase
          Endcase
        Return

    To set the attribute of a property on all the rows of the child class:

        $ACTIVATE_FIELDS
          ASTATUS = fmet this.ASETATTRIBUTE("PROPERTY",...
        Return
  • If the class path is the main class (CURPTH = "main_class_name"), the code is more complex. The Supervisor executes these events once for the entire entity:

        $METHODS
          Case CURPTH
            When ""
              Case ACTION
                When "AREAD_AFTER"
                  Gosub ACTIVATE_FIELDS
                Endcase
          Endcase
        Return

    To set the attribute of a property on all the rows of the child class, a loop must be coded to iterate through each row of the corresponding child collection.
    Note that CHILD(I) might not exist, and that deleted lines may still be there:

        $ACTIVATE_FIELDS
          For I = 1 To maxtab(this.CHILD)
            If this.CHILD(I)<>null and find(this.ASTALIN,[V]CST_ADEL,[V]CST_ANEWDEL)=0        
              ASTATUS = fmet this.CHILD(I).ASETATTRIBUTE("PROPERTY",...
            Endif
          Next
        Return

We recommend that you use the first method to avoid unnecessary loops, and to avoid dealing with indexes in a collection.