Traversing a Component Interface and Using Data Collections

The data in a Component Interface can be contained in a hierarchy: like the page it's built on, there may be data at level zero, level one, level two, and so on.

Each level of data in a Component Interface is known as a collection, such as:

level zero 

  -- level one (Collection)

    -- Level 2 (Collection)

A collection is a set of similar things, like a group of already existing Component Interfaces. Most collections have the same standard properties and methods, with some additional ones specific to that collection. For example, all collections have the property Count, which indicates how many items are in that collection, but only a data collection has the method ItemByKeys.

A data collection is the collection of data, available at runtime or during test mode, associated with a particular scroll (or record.) The data collection object returns information about every row of data (item) that is returned for that record at runtime.

To access the level two collection, in general, you could use the following:

&Level_1 = &CI.Level_1;
&Level_1_Item = &Level_1.Item(ItemNumber);

&Level_2 = &Level_1_Item.Level_2;

Image: Sample Component Interface with collection highlighted

This example illustrates the fields and controls on the Sample Component Interface with collection highlighted. You can find definitions for the fields and controls later on this page.

Sample Component Interface with collection highlighted

This example shows a Component Interface with a two-level hierarchy, that is, two data collections: EMPL_CHECKLIST and EMPL_CHKLST_ITM. To get a data collection for the first level, use the following code:

&Level1 = &MYCI.EMPL_CHECKLIST;

To access the secondary scroll (EMPL_CHKLST_ITM) you have to get the appropriate row (item) of the upper level scroll first:

&Level1 = &MYCI.EMPL_CHECKLIST;
&Item = &Level1.Item(1);
&Level2 = &Item.EMPL_CHKLST_ITM;

Note: Scrolls represent a hierarchical order. You must get the first level row that contains the secondary scroll before you can access the secondary scroll.

Every data collection has a set of methods and standard properties.