Accessing/ Traversing PeopleSoft Component Buffer


I am writing this article to get better understanding of accessing component buffer data .

In My Example I have used following levels and rowset, in your case it could be another rowset or derived/work record too
          Level0= PERSONAL_DATA (Example EMPLID=1234567)
          Level1=STDNT_CAREER ( Example CAREER=UnderGrade) 
          LEVEl2=STDNT_ACAD_PROG (Prog = BBA, BSC)


Level 0 Rowset
You first obtain the level zero rowset, which is the PERSONAL_DATA rowset. You do not need to know the name of the level zero rowset to access it:

&LEVEL0 = GetLevel0();

Rows of Level 0
The next object to get is a row. As the following code is working with data that is loaded from a page, only one row is at level zero. However, if you have rowsets that are populated with data that is not based on component buffers (for example, an application message), you may have more than one row at level zero.

&LEVEL0_ROW = &LEVEL0(1);

Child Rowsets
To obtain the level two rowset, traverse through the level one rowset first. 

Therefore, the next object to get is the level one rowset, as shown in the following example:

&LEVEL1 = &LEVEL0_ROW.GetRowset(SCROLL. STDNT_CAREER);

Obtaining Subsequent Rows (usually we go to level3 but if you have more then you can go further)

If you are traversing a page, obtain the appropriate row after you get a rowset. To process all the rows of the rowset, set this functionality up in a 
loop, as shown in the following example:

Obtaining Level2 Rowsets, Rows and Field Value(Complete Code)
We want to process all the rows at level two


&LEVEL0 = GetLevel0();
&LEVEL0_ROW = &LEVEL0(1);

&LEVEL1 = &LEVEL0_ROW.GetRowset(SCROLL. STDNT_CAREER); /*it will loop every career*/
For &I = 1 to &LEVEL1.ActiveRowCount
   &LEVEL1_ROW = &LEVEL1(&I);
   &LEVEL2 = &LEVEL1_ROW.GetRowset(SCROLL. STDNT_ACAD_PROG);
   For &J = 1 to &LEVEL2.ActiveRowCount /*it will loop every program under career*/
      &LEVEL2_ROW = &LEVEL2(&J);
      &RECORD = &LEVEL2_ROW. STDNT_ACAD_PROG;
      ​&FIELD = &RECORD.Descr;
      /* Do processing */
   ​End-For;
​End-For;