Sie sind auf Seite 1von 10

Explaining Data Flow in PeopleSoft Pure Internet Architecture (continued)

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:

Message number. Severity. Message text. Explanation.

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:

MsgGet(<MessageSet>,<MessageNum>,"DefaultMsgTxt", [<bindvar, bindvar>]);

Creating Error Messages Using the Message Catalog (continued)


Bind Variables To combine field values with message text in the Message Catalog, you use a bind variable with the MsgGet function. For example, when the Message Catalog string:

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.

Exploring More Development Tools (continued)


SetTracePC You can run a PeopleCode trace from within a PeopleCode program using the SetTracePC PeopleCode built-in function. Syntax:
SetTracePC(n)

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:

RowSelect PreBuild FieldDefault FieldFormula RowInit PostBuild Activate

Use RowSelect to:


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.

Do not place errors or warnings in RowInsert


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).

Save Action Events The save action events are:


SaveEdit SavePreChange Workflow SavePostChange

Use error and warning statements in SaveEdit to validate data

Do not place errors or warnings in SavePreChange. Do not place errors or warnings in SavePostChange.

In this lesson, you learned that:


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.

Explaining Message Catalog Functions (continued)


MsgGetText and MessageBox Two other functions that can be used to retrieve messages from the Message Catalog include MsgGetText and MessageBox. MessageBox retrieves messages from the Message Catalog, but provides the flexibility to change the severity of a message through the Message Catalog, without modifying PeopleCode.
MessageBox(style, title, message_set, message_num, default_txt [, paramlist])

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;

Traversing the Data Buffer (continued)


Steps The steps to traverse the component buffer from level 0 to level 1 are: Step 1. Declare data buffer objects. Step 2. Get the level 0 rowset. Step 3. Get the level 0 row. Step 4. Get a level 1 rowset. Step 5. Get a level 1 row. Step 6. Get a level 1 record. Step 7. Get a level 1 field.

Step 1 Declare data buffer objects


Local Local Local Local Rowset Row Record Field &RS_Level0, &RS_Level1; &Row_Level0, &Row_Level1; &Rec_TaskRsrc; &Fld_PctAvail;

Step 2. Get the level 0 rowset


&RS_LEVEL0 = GetLevel0();

Step 3. Get the level 0 row.


&ROW_LEVEL0 = &RS_Level0.GetRow(1);

Traversing the Rowset Step 4. Get a level 1 rowset.


&RS_LEVEL1 = &ROW_LEVEL0.GetRowSet(SCROLL.PSU_Task_RSRC);

Step 5. Get a level 1 row.

&Row_Level1

= &RS_Level1.GetRow(&I);

Step 6. Get a level 1 record.


&REC_TASKRSRC = &ROW_LEVEL1.GetRecord(RECORD.PSU_TASK_RSRC);

Step 7. Get a level 1 field.


&FLD_PCTAVAIL = &REC_TASKRSRC.GetField(FIELD.PCT_AVAILABLE);

Using Shorthand Dot Notation


Default Methods Here are the default methods for the rowset, row, and record classes. Source Object Rowset Row Row Record Return Default Method s Row &RowSet.GetRow(n) &Row.GetRowset(SCROLL.recname) (n) &Record.GetField(FIELD.fieldname) Record &Row.GetRecord(SCROLL.recname) Row Field Shorthand Notation &RowSet(n) &Row.recname &Row.recname(n) &Record.fieldname

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;

can be combined into a single statement:


&Pct = &RS_LEVEL1(&I).PSU_Task_RSRC.Pct_Available.Value; &RowSet.Sort(Fieldname, "A|D"[, Fieldname, "A|D"]);

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.

Step 1 Declare data buffer objects

Das könnte Ihnen auch gefallen