Download presentation
Presentation is loading. Please wait.
1
PeopleCode and the Component Processor
EIS Developer Forum February 8, 2007
2
PeopleCode and the Component Processor
PeopleCode is an object-oriented language Classes Objects Properties Methods
3
Classes A class is the formal definition of an object and acts as a template from which an instance of an object is created at runtime. The class defines the properties of the object and the methods used to control the object’s behavior.
4
Classes PeopleSoft delivers predefined classes (such as Array, File, Field, Rowset, SQL, and so on). You can create your own classes using the Application class. You can extend the functionality of the existing classes using the Application class.
5
Classes – An example File class - provides methods and properties for reading from and writing to external files
6
Objects An object represents a unique instance of a data structure defined by the template provided by its class. Each object has its own values for the variables belonging to its class and responds to methods defined by that class.
7
Object Instantiation A class is the blueprint for something, like a bicycle, a car, or a data structure. An object is the actual thing that's built using that class (or blueprint.) For example, from the blueprint for a bicycle, you can build a specific mountain bike with 23 gears and tight suspension. From the blueprint of a data structure class, you build a specific instance of that class. For example, an instance of the Record class could be PERSONAL_DATA. Instantiation is the term for building that copy, or an instance, of a class.
8
Object Instantiation – An Example
Define a variable Local File &fEMPDIRU_OUT; Instantiate the file object using the defined variable &fEMPDIRU_OUT = GetFile("/peoplesoft/lsdv/mods/dat/PS_EMPDIRU_OUT.txt", "W", %FilePath_Absolute); Note: GetFile is a built-in function used to instantiate a new file object from the File class, associate it with an external file, and open the file so you can use File class methods to read from or write to it.
9
Properties A property is an attribute of an object (think “adjective”). Properties define: Object characteristics, such as name or value. The state of an object, such as deleted or changed.
10
Properties – An Example
IsOpen is a property of the File class which returns a Boolean value indicating whether the file is open. If &fEMPDIRU_OUT.IsOpen Then Some of the other properties include CurrentRecord, IsError, Name.
11
Methods A method is the code associated with a given object (think “verb”). A method is a procedure or routine, associated with one or more classes, that acts on an object.
12
Methods – An Example WriteLine is a method of the File Class that writes one string of text, string, to the output file associated with the file object executing this method. &fEMPDIRU_OUT.WriteLine(&sRecOut); Some of the other methods include Close, Delete, Open, and ReadLine.
13
Dot Notation The means through which you access an object’s properties or execute its methods. This enables you to reference fields within a record object, records within a row object, and rows within a rowset object as properties of the parent objects.
14
Dot Notation – An Example
&Rec_Names = &Row_Names.NAMES; &sMaidenName = &Rec_Names.LAST_NAME.Value; DERIVED_NAME.UPDATE_NAME_BTN.Enabled = False;
15
Referencing Data in the Component Buffer
What is the Component Buffer? The area in memory that stores data for the currently active component. Consists of rows of buffer fields that hold data for the records associated with page controls, including primary scroll records, related display records, derived/work records, and Translate table records.
16
Ways to reference data In a contextual reference, PeopleCode refers to a row or buffer field determined by the context in which a PeopleCode program is currently executing (think “relative”). A scroll path specifies a scroll level in the currently active page (think “absolute).
17
Contextual Reference Refers to a row or buffer field determined by the context in which a PeopleCode program is currently executing. The current context includes All buffer fields in the row of data where the PeopleCode is executing All buffer fields in rows that are hierarchically superior to the row where the PeopleCode is executing
18
{ Contextual Reference Level zero row is always in context
Parent of row where executing takes place is in context Row where PeopleCode is currently executing All rows on lower scroll area out of context { If GetRowSet().ParentRowset.ParentRow.IsDeleted Then …
19
Scroll Paths A scroll path specifies a scroll level in the currently active page. If the level you want to reference is level one, you must supply only the RECORD.target_recname parameter. If the target scroll level is greater than level one, you must provide scroll name and row level parameters for all hierarchically superior scroll levels, beginning at level one.
20
Scroll Paths Target Level Scroll Path Syntax 1 2 3
RECORD.target_recname RECORD.level1_recname, level1_row, RECORD.level2_recname, level2_row,
21
Data Buffer Classes Repeat after me… Rowset Row Record Field
22
Data Buffer Classes Rowset
A rowset object is a data structure used to describe hierarchical data. It is made up of a collection of rows. Think of a rowset as a scroll on a page that contains all that scroll’s data. A level 0 rowset contains all the data for the entire component.
23
Data Buffer Classes Row
A row object represents a single row in a component scroll A row contains one or more records. A row may also contain child rowsets.
24
Data Buffer Classes Record
A record object is a single instance of data within a row and is based on a record definition. A record contains one or more fields.
25
Data Buffer Classes Field
A field object is a single instance of data within a record and is based on a field.
26
Occurs Level Review Component Level 0
Every component has at least one level 0 definition. The search key, and other fields from the same record definition, have a level of 0. There can only be one row of data for each level 0 record definition because scrolls begin at occurs level 1.
27
Occurs Level Review Component Level 0
28
Occurs Level Review Occurs Level 1
Scrolls allow you to insert, delete, and navigate through multiple rows of data. The keys of the occurs level 1 record definition must include the same search keys as level 0, with at least one additional key. PeopleSoft allows only one primary record definition per scroll. Fields from other record definitions may appear on a level for related display or as derived/work fields.
29
Occurs Level Review Occurs Level 1
30
Occurs Level Review Other Occurs Levels
The maximum possible value of an occurs level for a component is 3. PeopleSoft allows multiple primary record definitions at occurs level 2 and 3, but each primary record definition requires its own scroll. Occurs level 2 primary record definitions must have the same key fields as occurs level 1 plus at least one additional key field. Occurs level 3 primary record definitions must have the same key fields as occurs level 2 plus at least one additional key field.
31
Occurs Level Review Other Occurs Levels
32
Looping through Scroll Levels
Local rowset &RS; Local row &Row; Local record &Rec; Local field &Field; &RS = GetLevel0()(1).GetRowset(SCROLL.Owner); For &i = 1 to &RS.ActiveRowCount &Row = &RS.GetRow(&i); For &j = 1 to &Row.RecordCount &Rec = &Row.GetRecord(&j); For &k to &Rec.FieldCount &Field = &Rec.GetField(&k) End-For;
33
PeopleCode and the Component Processor
PeopleCode can be performed at different times during a component’s processing flow (called events) to allow for additional processing.
34
PeopleCode and the Component Processor
Whenever coding PeopleCode to enforce a business rule governing your data, you will need to know three things: WHEN you want it to execute WHERE to place your PeopleCode WHAT to program WHEN: which event in the flow of the Component Processor is most appropriate for your rule. WHERE: on which definition and, perhaps, on which field WHAT: the code syntax
35
WHEN you want it to execute
When during the flow of the Component Processor do you need your code to execute? Before the Search Page is displayed? When the page is activated? When a row is inserted or deleted? When a field is changed? When the user clicks the Save button?
36
WHERE to place your PeopleCode
Many different events are available: Record Field Events Component Record Field Events Component Record Events Component Events Page Event Menu Event
37
- Part 1
38
PeopleSoft Component Processor Flow - Part 2
39
WHAT to program
40
Workshop Tomorrow For more information on this topic, sign up for one of the workshops to be held tomorrow 9:00 am – 12:00 pm 1:00 pm – 4:00 pm
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.