Data Buffer Model and Data Access Classes

The data model assumed by the data buffer classes is that of a PeopleTools component, where scroll bars or grids are used to describe a hierarchical, multiple-occurrence data structure. You can access these classes using dot notation.

The four data buffer classes relate to each other in a hierarchical manner. The main points to understand these relationships are:

  • A record contains one or more fields.

  • A row contains one or more records and zero or more child rowsets.

  • A rowset contains one or more rows.

For component buffers, think of a rowset as a scroll area on a page that contains all of the data in that scroll area. A level zero rowset contains all the data for the entire component. You can use rowsets with application messages, file layouts, business interlinks, and other definitions in addition to components. A level zero rowset from a component buffer only contains one row: the keys that the user specifies to initiate that component. A level zero rowset from data that is not a component, such as a message or a file layout, might contain more than one level zero row.

The following is basic PeopleCode that traverses through a two-level component buffer using dot notation syntax. Level zero is based on record QA_INVEST_HDR, and level one is based on record QA_INVEST_LN.

Local Rowset &HDR_ROWSET, &LINE_ROWSET;
Local Record &HDR_REC, &LINE_REC;
&HDR_ROWSET = GetLevel0();

For &I = 1 to &HDR_ROWSET.RowCount
   &HDR_REC = &HDR_ROWSET(&I).QA_INVEST_HDR;
   &EMPLID = &HDR_REC.EMPLID.Value;
   &LINE_ROWSET = &HDR_ROWSET(&I).GetRowset(1);
   For &J = 1 to &LINE_ROWSET.RowCount
      &LINE_REC = &LINE_ROWSET(&J).QA_INVEST_LN;
      &LINE_SUM = &LINE_SUM + &LINE_REC.AMOUNT.Value;
   End-For;
End-For;

Each rowset is declared and instantiated. In general, your code is easier to read and maintain if you follow this practice.