Peoplecode to traverse component buffer data.
Problem Statement: Peoplecode to access component buffer data.
Scope: Target user are peoplesoft technical consultants.
In the given example 3 level of rowsets are used, in your case it could be another rowset or derived/work record too
Level0= JOB (Record present at level0 is JOB)
Level1=COMPENSATION (record at level1)
LEVEl2=LOCATION (Record at level 2)
Note: At max we can have upto Level 3
Source : http://docs.oracle.com/cd/E13292_01/pt849pbr0/eng/psbooks/tpcd/chapter.htm?File=tpcd/htm/tpcd05.htm |
Level 0 Rowset
You first obtain the level zero rowset, which is the JOB 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.COMPENSATION);
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.COMPENSATION);
For &I = 1 to &LEVEL1.ActiveRowCount
&LEVEL1_ROW = &LEVEL1(&I);
&LEVEL2 = &LEVEL1_ROW.GetRowset(SCROLL.LOCATION);
For &J = 1 to &LEVEL2.ActiveRowCount
&LEVEL2_ROW = &LEVEL2(&J);
&RECORD = &LEVEL2_ROW.COMPENSATION;
&FIELD = &RECORD.Descr;
/* Do processing */
End-For;
End-For;
No comments:
Post a Comment