Developer in PeopleCode: are you 'Long' or 'Short'? by Pascal Thaler

For traversing the Data Buffer Component (down to level2):

  1. If you are 'Long' (Declaring all classes of objects):
    (You are looking for recordName.fieldName : NAME_RECD2. NAME_FIELD2 on Level 2).
    Component Rowset &level0, &level1, &level2;
    Component Row &level0_row, &level1_row, &level2_row;
    Component Record &Record;
    Component Field &Field;

    &level0 = GetLevel0();
    &level0_row = &level0(1);
    &level1 = &level0_row.GetRowset(SCROLL.PRIMARY_REC_LVL1);

    For &I = 1 to &level1.ActiveRowCount
    &level1_row = &level1(&I);
    &level2 = &level1_row.GetRowset(SCROLL. PRIMARY_REC_LVL2);
    For &J =1 to &level2.ActiveRowCount
    &level2_row = &level2(&J);
    &RECORD = &level2_row.NAME_RECD2;
    &FIELD = &RECORD. NAME_FIELD2;
    End-For;
    End-For;
    Summary:
    There are 16 lines of code and 8 objects are declared.
    It is difficult to read and manipulate this PeopleCode, because all intermediate objects are declared (and only used one time).
  2. If you are 'Short' (Declaring only the necessary class objects):
    Component Rowset &level0;
    Component Field &Field;

    &level0 = GetLevel0();
    For &I = 1 to &level0(1).GetRowset(SCROLL.PRIMARY_REC_LVL1). ActiveRowCount
    For &J =1 to &level0(1).GetRowset(SCROLL.PRIMARY_REC_LVL1)(&I).
    GetRowset(SCROLL. PRIMARY_REC_LVL2).ActiveRowCount;&FIELD= &level0(1).
    GetRowset(SCROLL.PRIMARY_REC_LVL1)(&I). GetRowset(SCROLL. PRIMARY_REC_LVL2)(&J).
    NAME_RECD2. NAME_FIELD2;
    End-For;
    End-For;
    Summary:
    There are only 6 lines of code and 2 declared objects.
    It is difficult to read and manipulate this PeopleCode, because no intermediate objects are declared and, each time you must access object (properties or methods), you have to start from the highest object:
    &level(0).GetRowset(....................)
  3. So, the easiest PeopleCode (for this example) is:
    Component Rowset &level0, &level2;
    Component Field &Field;

    &level0 = GetLevel0();
    &level2 = &level0(1).GetRowset(SCROLL.PRIMARY_REC_LVL1).
    /* Only one intermediate object is declared, and it is a rowset object */
    For &I = 1 to &level2.ActiveRowCount
    For &J =1 to &level2.GetRowset(SCROLL.PRIMARY_REC_LVL2).ActiveRowCount;

    &FIELD= &level2.GetRowset(SCROLL. PRIMARY_REC_LVL2)(&J). NAME_RECD2. NAME_FIELD2;
    End-For;
    End-For;
    Summary:
    There are 9 lines of code and 3 declared objects.
    It is easier to read and manipulate this PeopleCode, because only a few intermediate objects are declared and, your way of accessing the object is not too long, and not too short.

For more information about manipulating the data buffer, please access the Enterprise PeopleTools 8.50 PeopleBook: PeopleCode Developer's Guide and click on the left pagelet: Referencing Data in the Component Buffer.

Here are 3 useful links for more information about PeopleSoft:


Pascal Thaler

Pascal Thaler joined Oracle University in 2005 where he is a Senior Instructor. His area of expertise is Oracle Peoplesoft Technology and he delivers the following courses:



  • For Developers: PeopleTools Overview, PeopleTools I & II, Batch Application Engine, Language Oriented Object PeopleCode, Administration Security
  • For Administrators : Server Administration & Installation, Database Upgrade & Data Management Tools
  • For Interface Users: Integration Broker (Web Service).
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Expert trainers from Oracle University share tips and tricks and answer questions that come up in a classroom.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
22
23
24
25
26
27
28
29
30
   
       
Today