People Code
People Code
March 2007
Agenda
PeopleCode Editor
PeopleCode Language
PeopleCode Programs and Events
PeopleCode Component Processor
Component Buffer
Using Errors and Warnings
System Variables
Meta SQL
PeopleCode Debugger
Capgemini India – PeopleSoft Practice
PeopleCode Editor
PeopleCode Editor…
PeopleCode Language
PeopleCode Language…
It includes
• Data types.
• Comments
• Statements.
• Functions.
• Expressions.
• Operators.
PeopleCode Language – Data Types
Boolean
Date
DateTime
Float
Integer
Number
Object
String
Time
PeopleCode Language – Object Data types
• Field
• Record
• Row
• Rowset
• Grid
• GridColumn
• Page
PeopleCode Language – Object Data types
• AESection
• Array
• File
• Message
• SQL
PeopleCode Language – Comments
You can surround comments with /* at the beginning and */ at the end.
You can surround commented text with <* at the start and *> at the end.
variableName = expression;
PeopleCode Language – Statements
Evaluate Statement
evaluate &USE_FREQUENCY
when = "never"
PROD_USE_FREQ = 0;
Break;
when = "sometimes"
PROD_USE_FREQ = 1;
Break;
when = "frequently"
PROD_USE_FREQ = 2;
Break;
when-other
Error "Unexpected value assigned to &USE_FREQUENCY."
end-evaluate;
PeopleCode Language – Statements
Repeat Statement
When Statement
PeopleCode Language – Functions
Supported functions.
Function definitions.
Function declarations.
Function calls.
Example:
If DeleteRow(RECORD.BUS_EXPENSE_PER, &L1_ROW,
RECORD.BUS_EXPENSE_DTL, &L2_ROW) then
WinMessage("Row deleted.");
else
WinMessage("Sorry -- couldn’t delete that row.");
end-if;
PeopleCode Language – Functions declarations
For e.g
Declare Function UpdatePSLOCK PeopleCode FUNCLIB_NODES.MSGNODENAME
FieldFormula;
PeopleCode Language – Functions calls and Return values
Constants
• Numeric Constants
• String Constants
• Boolean Constants
• Null Constants
• User-Defined Constants
Variables
• User Defined variables
• System Variables
Global
The variable is valid for the entire session.
Component
The variable is valid while any page in the component in which the variable
is defined stays active.
Local
The variable is valid for the duration of the PeopleCode program or function
in which the variable is defined.
You can declare variables using the Global, Local, or Component statements, or
you can use local variables without declaring them.
Examples:
Local Number &AGE;
Global String &OPER_NICKNAME;
Component Rowset &MY_ROWSET;
Capgemini India – PeopleSoft Practice
The following are the events that are associated with a record
field:
• FieldChange Event
• FieldDefault Event
• FieldEdit Event
• FieldFormula Event
• RowInit Event
• RowSelect Event
• RowDelete Event
• PrePopup Event
• SaveEdit Event
• SavePreChange Event
• Workflow Event
• SavePostChange Event
• SearchInit Event
• SearchSave event
Access component record field PeopleCode
• PostBuild Event
• PreBuild Event
• SavePostChange Event
• SavePreChange Event
• Workflow Event
Access page PeopleCode
Default processing.
Search processing in update mode.
Search processing in add mode.
Component build processing in update mode.
Row select processing.
Component build processing in add mode.
Field modification.
Row insert processing.
Row delete processing.
Buttons.
Prompts.
Pop-up menu display.
Selected item processing.
Save processing.
Processing sequences
Field Modification
Processing sequences
Buttons
When a user presses a button, this initiates the same
processing as changing a field. Typically, PeopleCode
programs started by button are placed in the FieldChange
event.
Prompts
No PeopleCode event is initiated as a result of prompts,
returning to the search page or displaying a calendar. This
process is controlled automatically by the system.
Note. When the value of a field is changed using a prompt,
the standard field modification processing occurs.
Processing sequences
Save Processing
PeopleSoft Internet Architecture Processing Considerations
Component Buffer
Component Buffer
Primary record on If scroll level 0 of a page contains only controls associated with primary scroll
scroll level 0 record fields that are search keys or alternate search keys, then only the search
key and alternate search key fields will be in the Component Buffer: not the entire
record. The values for the fields come from the keylist, and the record won't run
RowInit PeopleCode. If level 0 contains at least one record field from the primary
scroll record that is not a search key or alternate search key, then all the record
fields from the primary scroll record will be available in the buffer. (For this reason
you may sometimes need to add one such record field at level 0 of the page to
make sure that all the record fields of the level-zero primary record can be
referenced from PeopleCode.)
Related display The buffer contains the related display record field, plus any record fields from the
record fields related display record that are referenced by PeopleCode programs. This means
that you can reference any record field in a related display record.
Derived/work record Only derived/work record fields associated with page controls are in the
fields Component Buffer. Other record fields from the derived/work record cannot be
referenced from PeopleCode.
Translate Table Only Translate Table fields associated with page controls are available in the
record fields Component Buffer. Other fields from the Translate Table cannot be referenced
from PeopleCode.
Component Buffer
Contextual Reference
The current context comprises a subset of the buffer fields in
the component buffer, determined by the row of data where
a PeopleCode program is executing. The current context
includes:
All buffer fields in the row of data where the PeopleCode
program is executing.
All buffer fields in rows that are hierarchically superior to
the row where the PeopleCode program is executing.
A contextual row reference uses a RECORD.recordname
component name reference to specify the scroll level of the
intended row, resulting in a reference to the current row at
the specified scroll level.
Component Buffer
Data Buffer
Data Buffer
Definition:
Data buffer classes are used access the Component buffers
which are loaded when you open a component, or from
general data buffers, loaded by an Application Message, an
Application Engine program, a Business Component, and so
on.
Data Buffer Classes
The four data buffer classes relate to each other in a hierarchical manner:
A field object, which is instantiated from the Field class, is a single
instance of data within a record and is based on a field definition.
A record object, which is instantiated from the Record class, is a
single instance of a data within a row and is based on a record
definition. A record object consists of one to n fields.
A row object, which is instantiated from the Row class, is a single
row of data that consists of one to n records of data. A single row in
a component scroll is a row. A row may have one to n child rowsets.
For example, a row in a level 2 scroll may have n level 3 child
rowsets.
A rowset object is a data structure used to describe hierarchical
data. It is made up of a collection of rows. A component scroll is a
rowset. You can also have a level 0 rowset.
Data Buffer Class Objects
An error in SaveEdit prevents the system from saving any row of data.
The Component Processor does not update the database for any field if
one field has an error. Although the Component Processor displays an
error message, it does not turn any field red. Unlike FieldEdit errors,
SaveEdit errors can happen anywhere on the page or component, for any
row of data. The data causing the error may appear on a different page
within the same group, or a row of data not currently displayed. If this is
the case, the field in error is brought into view by the system.
RowSelect PeopleCode filters out rows of data after the system applies
search record criteria. It also can stop the Component Processor from
reading additional rows of data.
A warning causes the Component Processor to reject the current row, but
the Component Processor does continue reading more data. An error
prevents any more data coming into the page or component. The
Component Processor accepts the row that causes the error, but doesn't
read any more data. If you want to reject the current row and stop loading
additional rows, you must issue a warning and an error.
You must specify text for an error or warning, but the Component
Processor does not display messages from RowSelect. You can still use
the message text as a way of documenting the program.
Errors and Warning in RowDelete
When you delete a row of data (F8), the system prompts you
to confirm. If you do confirm, RowDelete PeopleCode takes
place, that is, any record field RowDelete PeopleCode fires,
and any component record RowDelete PeopleCode. Errors
and warnings in RowDelete display a message box.
System Variables
System Variables
There are many different System variables provided by PeopleTools. Listed below are
few frequently used ones
• %AsOfDate
• %Component
• %CompIntfcName
• %Currency
• %FilePath
• %Page
• %PasswordExpired
• %PermissionLists
• %Portal
• %Roles
• %RowSecurityPermissionList
• %ServerTimeZone
• %Session
• %Time
• %UserId
Capgemini India – PeopleSoft Practice
PeopleCode Debugger
PeopleCode Debugger
PeopleCode Debugger
• has a visual indicator of breakpoints, an arrow indicating the current line and the ability to step
through code.
• can inspect the value of a variable by 'hovering' your cursor over it and reading the pop-up
bubble help.
• provides variable inspection windows for Globals, Locals, Function Parameters, and
Component scoped variables.
• enables PeopleCode objects to be "expanded", so you can inspect their component parts.
• Visible breakpoints.
• Hover inspect.
• Single debugger.
• Variable panes.
Visible current line of execution
Thank You