Top Banner
People Code 1
34
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: People Code

People Code

1

Page 2: People Code

Day one:

•Component processor flow and People code

•Understanding the implications of using different people code events

•Examples and uses of each people code event.

•Choosing the right people code event to fit processing requirements

2

Page 3: People Code

Day Two:

• Introduction to People code• Accessing People code• Feature of People code editor• People code statements• People code variables Object Oriented Programming PeopleSoft•Define the term Class•Define the term Object•Instantiate an Object•Use dot notation to execute object method

People code functions•Identify the deferent types of user defined functions and learn the steps to writing External –people code function.•Identify and use people code built in function

3

Page 4: People Code

Day Three: • Determine the precise order in which the component processor allocates buffers for the data it retrieves into a component

• Identify which people code program in a component will be executed

• Predict the exact order in which people code is executed based on occurrence level and the buffer rules of the buffer allocation.

• Understanding how looping constructs are used in people code

• Understand the buffer access in people tools

4

Page 5: People Code

Day Four:

•Over view of Application class and Application class

•Debugging the people code

Page 6: People Code

Over View :

People code is a user defined exit point from the component processor flow that allows the additional processing beyond the capabilities of the people tools .people code program can be performed at different times during the component process flow. The type of processing that occurs depend s on the placement of those people code programs Whenever you are coding the people code to enforce the business rule governing the data. You will need to know three things.•When you want to execute the people code. This refers to the people code event during which the code is trigger•Where to place the people code. this refers to location (i.e. object definition) on which the code exist.•What people code syntax to use. This refers the actual people code program itself.

6

Page 7: People Code

Objectives:

•Identify the component Processor flow with people code

•Understanding the implication of using different people code events

•Identify different examples and uses of each people code event

•Choosing the right people code event to fit processing requirement

7

Page 8: People Code
Page 9: People Code

Determine Component

Reset State

SearchPage

Add? SQLSelect

Add ModeProcessing

More rowsto read

Add Row to Buffer

RecordDetails

Save Cancel Pop-upMenu

Field changedby User

Row Insert Row Delete

Display pageand wait forUser action

Provisionally Update Tables(SQL Insert, Delete, Update)

Pop-up MenuDisplay

StandardSystem Edits

Add Row ProvisionallyDelete Row

SQL Commit

Type

Go to A Accept FieldChange

?

A

User selectsMenu item

New Component/

Unrecoverable Errors

Yes

No

Yes

No

Key

Error

assedStandard/

Transfer

Wait for Operator Action

Page 10: People Code

10

Actual Component Processor Flow:

Reset state and the search record: After logging in to the application the or existing component, application data is cleared from the buffer. This is called Reset State. When user selects the component (vie a content reference ) from the portal menu, the component processor displays an Add or Search page(depending on the default search method for the component ) . Component processor uses the selected (from list box) or entered value to identify what data to be retrieve.

After the Search: The component processor can retrieve all the data need for the entire component . it retrieve the data that matches the search key . once all the data is selected the component processor allocate buffer space to hold the application on data on the web server while component is in use. Component processor has allocated buffer space and load the appropriate data , it applies any record defaults , displays the component to user and waits for user action.

Page 11: People Code

11

Field Action Events:

The user may decided to change of the values of a field . In edit box and long edit boxes , a field considered to be changed when you exit. Check boxes, and radio buttons will record a change immediately. Drop down is considered to be changed when you select data,after each field is changed the component does some standard edits such as formatting and checking against the prompt table. If it fails then it will display error message and turn the field red. The component processor will not let the changes saved. Once correction made done then it will save the component and displays the page again.

Note: if deferred processor is enabled for the component , the field action event will not occur until user saves the component.

Row Action Events:

Scroll areas are used to move through rows of data online. Rows of data within the scroll area can either added using row insert or deleted using row delete. The component processor adds or removes a row of data. Then displays the page again and waits for another user action

Page 12: People Code

12

Save Action Events:

A component will be saved when the user clicks the save button.After the component is saved. The component issue a appropriate SQL updates to the data base. The component processor displays the page and waits for another user action.

Pop –up Menu:

If the end-user clicks the pop-up icon next to the field a pop-up menu appears . this can be default pop-up menu or one that has been defined by the developer. If the user clicks the related link button in the component toolbar, the pop-up menu for the page displayed. People code may be placed on the pop-up menu.

Page 13: People Code

13

Page 14: People Code

People code Categorizes:

The component processor performs people code as it processes a page. There six general areas where the component processor performs the people code.•During the search Page•Before displaying a page•After a field change•After inserting and deleting a new •After a page is saved•After processing pop –up menu

Search Events:Once the page and action have been selected , a search dialog is displayed . search init people coed performs right before the page is displayed to initialization fields or apply defaults to the search page.After the appropriate values have been entered into the dialog and search save push button is clicked . Searchsave people code will be performed.Note:Both search people code events will be performed if he code is attached on the search record to fields that will appear in the dialog (key and alternate search Key).

Page 15: People Code

Page Startup Events: Before user can work with component, the component processor

uses the data which was retrieved based on the user selected/entered value, then component build component . before displaying component to user. Seven people code events are invoked.They are :

RowSelect Prebuild, FieldDefault FieldFormulea RowInit Post Build Activate Note: Prebuild and post build are executed only once when the

component is build. Activate fires only when the user selects page.

Page 16: People Code

Field Action Events:

Two people code events are activated when the value of a field changed.

Field edit Field change

Row Action Events: Row insert people code is performed after the inserting a new of

data. When row inserted is performed, the component processor will also perform rowinit people code on just the new row as part of displaying the page. Row delete people code is performed after deleting a row of data.

Save Action Events: When user click on the save button tells the component processor to

take the information that has changed in its buffer and update it to database. Before updating the data base following people code will be taken place.

They are: SaveEdit Save Prechange Workflow Savepostchange

Page 17: People Code

Pop-up Menu Events: If user access a pop–up menu that was defined in the application

designer then pre-popup events fires before the pop-up menu is displayed.

If the user selects the menu item from the pop-up list that has a people code program attached to it, then item selected events will fires.

Add Action:Add mode processing Is handled bit differently by the component processor. For row added with component search key a flow of events will be..

RowInit Searchinit Fieldedit Field change Saveedit And finally searchsave prior to the user receiving the GUI.

Page 18: People Code

Deferred Processing: From People soft 8 the component buffer on application server

and all people code will be execute at application server. It can results the performance impact when there is lots of field action process, i.e

FieldEdit and Fieldchange Peoplecode along with system field edit. People soft provides the three way to improve the performance. If field changed and there is no field edit or fieldchange people

code on the field, record defaults and field default people code will not be ran until some other action cause the server trip.

Developers are encouraged to put the field edit validation at the save edit as much as possible to reduce the server trip

Developer have the option to enable the deferred processing ,which automatically defer field change processing until the user clicks on the save button.

Page 19: People Code
Page 20: People Code

Events

SearchInit Event

The SearchInit event is generated just before a search, add, or data-entry dialog box is displayed.

You can activate system defaults and system edits in the search page by calling SetSeachDefault and SetSearchEdit in SearchInit PeopleCode.

You can also control the behavior of the search page, either forcing it to appear even if all the required keys have been provided, or by skipping it if possible, with the SetSeachDialogBehavior function.

This event, and all its associated PeopleCode, do not initiate if run from a component interface.

SearchInit People Code can be associated with search record fields and component search records.

Do not place Errors and warnings in SearchInit. You can't use the following functions in SearchInit PeopleCode:

DoModal DoModalComponent Transfer TransferPage

Page 21: People Code

SearchSave Event

SearchSave People Code is executed for all search key fields on a search, add, or data-entry dialog box after a user clicks Search.

It provides a way to edit information entered in the search dialog.

This event is also used to force a user to enter a value in at least one field.

SearchSave is not initiated when values are selected from the search list. To validate data entered in the search page, use the Component Prebuilt event.

You can use Error and Warning statements in Searchsave People Code to send the user back to the search page if the user entry does not pass validations implemented in the People Code.

This event, and all its associated People Code, is not initiated if run from a component interface.

SearchSave People Code can be associated with record fields and component search records.

Do not use the %Menu system variable in this event. You may get unexpected results.

Page 22: People Code

PreBuild Event

The PreBuild event is initiated before the rest of the component build events.

This event is often used to hide or unhide pages. It’s also used to set component variables. If a PreBuild PeopleCode program issues an error or

warning, the user is returned to the search page. If the search record has no keys, a blank component page appears.

Also use the PreBuild event to validate data entered in a search page after a prompt list is displayed.

Page 23: People Code

FieldDefault Event

The FieldDefault PeopleCode event enables you to programmatically set fields to default values when they are initially displayed.

If a record default is specified for the blank field, it is applied. If the field does not have a record default and is still blank, FieldDefault PeopleCode is applied.

FieldDefault PeopleCode can be associated with record fields and component record fields.

Do not place Errors and warnings in FieldDefault.

Page 24: People Code

FieldFormula Event

FieldFormula is now often used in FUNCLIB_ (function library) record definitions to store shared functions.

FieldFormula PeopleCode is only associated with record fields.

The FieldFormula event is not currently used. Because FieldFormula PeopleCode initiates in many different contexts and triggers PeopleCode on every field on every row in the component buffer, it can seriously degrade application performance. Use RowInit and FieldChange events rather than FieldFormula.

InPeopleSoft Pure Internet Architecture, if a user changes a field, but there is nothing to cause a trip to the server on that field, default processing and FieldFormula PeopleCode do not run. They only run when another event causes a trip to the server.

Page 25: People Code

RowInit Event

The RowInit event is initiated the first time that the Component Processor encounters a row of data.

I Use it to set the initial state of component controls. This occurs during component build processing and row

insert processing. It also occurs after a Select or Select All Rowset method, or a Scroll Select or related function, is executed.

RowInit is not field-specific: it triggers People Code on all fields and on all rows in the component buffer.

RowInit PeopleCode is often paired with FieldChange People Code. In these RowInit/FieldChange pairs, the RowInit PeopleCode checks values in the component and initializes the state or value of page controls accordingly. FieldChange PeopleCode then rechecks the values in the component during page execution and resets the state or value of page controls.

Page 26: People Code

PostBuild Event The PostBuild event is initiated after all the other component

build events have been initiated. This event is often used to hide or unhide pages. It’s also used to set component variables.

PostBuild People Code is only associated with components.

Page Active

The Activate event is fired each time the page is activated. This means when the page is first displayed by the end-user, or if a end-user presses TAB between different pages in a component. Each page has its own Activate event.

The main purpose of the Activate event is to segregate the People Code that is related to a specific page from the rest of the application’s PeopleCode. People Code related to page display or page processing, such as enabling a field or hiding a scroll, is best put in this event. Also, you can use this event for security validation: if an user doesn’t have clearance to view a page in a component, you would put the code for hiding it in this event.

Page 27: People Code

PostBuild Event The PostBuild event is initiated after all the other

component build events have been initiated. This event is often used to hide or unhide pages. It’s also used to set component variables.

PostBuild People Code is only associated with components.

Page Active The Activate event is fired each time the page is activated.

This means when the page is first displayed by the end-user, or if a end-user presses TAB between different pages in a component. Each page has its own Activate event.

The main purpose of the Activate event is to segregate the People Code that is related to a specific page from the rest of the application’s PeopleCode. People Code related to page display or page processing, such as enabling a field or hiding a scroll, is best put in this event. Also, you can use this event for security validation: if an user doesn’t have clearance to view a page in a component, you would put the code for hiding it in this event.

Page 28: People Code

Field Edit

Use FieldEdit PeopleCode to validate the contents of a field, supplementing standard system edits. If the data does not pass the validation, the PeopleCode program should display a message using the Error statement, which redisplays the page, displaying an error message and turning the field red. To permit the field edit but alert the user to a possible problem, use a Warning statement instead of an Error statement. A Warning statement displays a warning dialog box with OK and Explain buttons. It permits field contents to be changed and continues processing as usual after the user clicks OK. If the validation must check for consistency across page fields, then use SaveEdit PeopleCode instead of FieldEdit.The FieldEdit event applies to the field and row that just changed.FieldEdit PeopleCode can be associated with record fields and component record fields

Page 29: People Code

FieldChange Event

1) Use FieldChange PeopleCode to recalculate page field values, change the appearance of page controls, or perform other processing that results from a field change other than data validation. To validate the contents of the field, use the FieldEdit event.

RowInsert Event When a user adds a row of data, the Component Processor

generates a RowInsert event. You should use RowInsert PeopleCode for processing specific to the insertion of new rows. Do not put PeopleCode in RowInsert that already exists in RowInit, because a RowInit event always initiates after the RowInsert event, which will cause your code to be run twice.

You can prevent a user from inserting rows into a scroll area by selecting the No Row Insert check box in the scroll bar’s page field properties, as shown in the following illustration. However, you cannot prevent row insertion conditionally.

Page 30: People Code

RowDelete Event

The RowDelete event is initiated whenever a user attempts to delete a row of data from a page scroll area. Use RowDelete PeopleCode to prevent the deletion of a row (using an Error or Warning statement) or to perform any other processing contingent on row deletion. For example, you could have a page field called Total on scroll area level zero whose value is the sum of all the Extension page fields on scroll area level one. If the user deleted a row on scroll area level one, you could use RowDelete PeopleCode to recalculate the value of the Total field.

When the last row of a scroll area is deleted, a new, dummy row is automatically added. As part of the RowInsert event, RowInit PeopleCode is run on this dummy row. If a field is changed by RowInit (even if it’s left blank), the row is no longer new, and therefore is not reused by any of the ScrollSelect functions or the Select method. In this case, you may want to move your initialization code from the RowInit event to FieldDefault.

Page 31: People Code

WorkFlow Event

Workflow PeopleCode executes immediately after the SavePreChange event and before the database update that precedes the SavePostChange event. The Workflow event segregates PeopleCode related to workflow from the rest of the application’s PeopleCode. Only PeopleCode related to workflow (such as TriggerBusinessEvent) should be in workflow programs. Your program should deal with the Workflow event only after any SavePreChange processing is complete.

Page 32: People Code

SavePostChange Event

1) After the Component Processor updates the database, it initiates the SavePostChange event. You can use SavePostChange PeopleCode to update tables not in your component using the SQLExec built-in function.

2) The system issues a SQL Commit statement after SavePostChange PeopleCode completes successfully.

3) If you are executing Workflow PeopleCode, keep in mind that if the Workflow PeopleCode fails, SavePostChange PeopleCode is not executed. If your component has both Workflow and SavePostChange PeopleCode, consider moving the SavePostChange PeopleCode to SavePreChange or Workflow.

4) Never issue a SQL Commit or Rollback statement manually from within a SQLExec function. Let the Component Processor issue these SQL commands.

Page 33: People Code

Summary Of All Events:Component:

PreBuild

PostBuild SavePrechangeSavePostChange WorkFlow

Component Record Filed: FieldDefault

FieldEditFieldChangePrepopUp

Page 34: People Code

Component Record:

RowDelete

RowInitRowInsertSaveEditRowSelectSavePrechangeSavePostChange

Record Field:Except Activate, PreBuild and PostBuild Events.

Total 15 events will be execute