People Code Note
People Code Note
This diagram displays the flow of an application in the PeopleSoft Pure Internet Architecture:
A TableSet is a group of rows in a control table identified by the same high-level key: TableSetID or the SETID field. All control tables used in TableSet sharing have the SETID field as the highlevel key, as shown in this diagram:
Implementing TableSet Sharing The technical tasks for implementing TableSet sharing comprise five steps: Steps one through four address the record definition. Step 5 addresses the page definition.
1. 2. 3. 4. 5.
Add BUSINESS_UNIT to a transaction table or SETID to a control table. Define the Set Control Field in the control table. Create or alter the table. Add PeopleCode to the business unit table. Alter the page.
Defining the Set Control Field If creating a control table, you will need to do step 2 and define the Set Control Field in the Record Properties dialog box. Most often you select BUSINESS_UNIT in the Set Control Field drop-down list box.
The following diagram shows the process for implementing TableSet sharing.
Message Sets Each message within a message set contains these elements:
Retrieving Messages You retrieve messages from the Message Catalog using PeopleCode functions. The MsgGet function in PeopleCode is used in conjunction with message delivery functions such as Error or Warning to retrieve a message and display it to the user. The syntax is:
Course start date (%1) must not be later than course end date (%2).
Is called by the PeopleCode statement:
Error MsgGet(1040, 3, "Message Not Found: Course Start Date must not be later than End Date.", PSU_CRS_SESSN.START_DATE, PSU_CRS_SESSN.END_DATE) End-If;
Then %1 is replaced in the text string by the value in PSU_CRS_SESSN.START_DATE, and %2 is replaced by PSU_CRS_SESSN.END_DATE.
The following example will turn on trace with Show Assignments to Variables and Show Fetched Values
SetTracePC(4+8);
Turn off the trace by calling SetTracePC with a parameter value of zero.
Component Build and Page Display Events The component build and page display events are:
Prevent a row from loading by using the DiscardRow function. Stop loading rows into the buffer by using the StopFetching function.
RowSelect PeopleCode is placed on a record field or component record. Warnings and errors can be placed in RowSelect but will not be displayed to the user and are not used for that purpose in this event. Do not place errors or warnings in FieldDefault. Do not place errors or warnings in FieldFormula except within a function.
Do not place errors or warnings in RowInit because it occurs only once, while RowInit code executes once for every row.
Put PeopleCode related to page display or page processing, such as enabling a field or hiding a scroll, in this event. Use this event for security validation. Do not place errors or warnings in Activate.
Error statements prevent a row from being deleted. Warning statements allow the user to accept the Row Delete (OK), or cancel the Row Delete (Cancel).
Do not place errors or warnings in SavePreChange. Do not place errors or warnings in SavePostChange.
There are seven component build and page display events. RowSelect can be used to filter out rows of data from the component. Use PreBuild to hide or unhide pages and to set component and global variables. Use FieldDefault to assign default values to empty fields. Use FieldFormula only to store function libraries or Web libraries. Use RowInit PeopleCode to initialize field display characteristics or to perform calculations on rows of existing and on newly inserted rows of data. Use PostBuild to hide or unhide pages, perform calculations and to set component and global variables. Use Activate set the display characteristics specific to a page.
MsgGetText is very similar to MsgGet except the message set and message number will not appear after the text of the message.
MsgGetText(message_set, message_num, default_txt [, paramlist]) Declare Function function_name PeopleCode record_name.field_name event_name;
&Row_Level1
= &RS_Level1.GetRow(&I);
You can string together dot notation to form a single statement. For instance, the following four lines
&Row_Level1 &Rec_TaskRsrc &Fld_PctAvail &Pct = = &RS_Level1(&I); = &Row_Level1.PSU_Task_RSRC; = &Rec_TaskRsrc.Pct_Available;
&Fld_PctAvail.Value;
DML statements can only be issued in FieldChange (as of 8.4), SavePreChange, WorkFlow, and SavePostChange.
Fetch For a SQL object containing a Select statement, the Fetch method is used to retrieve the next row from the cursor.
&SQL.Fetch(bind_values)
Fetch takes as its argument output variables to receive values from the Select. When there are no more rows, Fetch returns as False You must use the Fetch method as part of an expression, typically using an If, While, or an assignment statement. If you are only retrieving one row, just use a SQLExec.
SelectByKey The SelectByKey method selects one row of data based on the key values provided.
SelectByKey(key1, key2, ...)
SelectByKey will return True on successful completion (which includes returning zero rows) and False if the record is not found. If not all keys are set, so that more than one row would be retrieved, SelectByKey wont fetch any data and you wont receive an error. You use SelectByKeyEffdt to select the current row from a table. It is used the same as SelectByKey, but takes a date as its argument.