Tuesday 25 December 2018

FieldEdit vs FieldChange Event in PeopleSoft

FieldEdit event is more of a validation event used to validate the value entered in a field and throw error/warning if the value is not what is supposed to be when the cursor is tabbed out. This event won't allow the user to save transaction unless and until the appropriate value isn't provided in the field and the validation passed. The FieldChange PeopleCode fires after the field value has been changed.


FieldChange event is used where you want to change other fields in response to when another field is changed. The FieldEdit PeopleCode fires before the field value 
is actually changed.


HAPPY LEARNING:)

PreBuild Vs PostBuild Event in PeopleSoft

PreBuild fires before any PeopleCode code event on all the rows and fields in the component such as FieldDefault and RowInit. During the PreBuild event, there will not be any data in the component buffer other than the search record as it's executing prior to the component build process.

During the PostBuild event, you will have access to the data read from the database into the component buffer.

PreBuild and PostBuild is most commonly used to hide or unhide pages.



HAPPY LEARNING :)

Monday 26 November 2018

Dynamic view in PeopleSoft

Views are a useful feature of SQL databases, letting us create virtual tables based on SQL select statements.
PeopleSoft 8 provides the functionality to create dynamic views. These are essentially SQL statements executed on the fly by the PeopleSoft component processor. We can use dynamic views in Peoplesoft pages only because they are PeopleTools objects, not SQL Objects.
Using Dynamic view as Prompt Table
In this article, we will see the use of Dynamic view as a prompt table. Please note that a dynamic view can be used for other purposes such as search records which will not be discussed in the article.
One major question that pops up to many of us the first time we use a dynamic view, why not use a normal view instead of a dynamic view. A dynamic view’s select statement may include Peoplesoft’s meta-SQL, and it may be replaced by a different SQL statement while the user is using the page. And also there might be situations where which you do not save the view in the database.
Using Edit Table for prompt tables
Assume that you have a page in which the user selects a country and depending on the selection you want a different prompt table for the states. For example, if the user selects US show states for US and user selects Canada show states of Canada.
This can be achieved by following the steps below
Step 1: Create two views/dynamic views to show the states of the US and Canada.
Step 2: Go to record field, in our case it is state field (Right click and select View Definition on the state field on the page).
Step 3: Right Click and select Record Field Properties
Step 4: Select Edits tab and then select Table Edit. Select Prompt table with edit( or No Edit) as per your requirement. Write %EDITTABLE against Prompt table.*EDITTABLE is a field in table named DERIVED, provided by PeopleSoft.
Step 5: Place the EDITTABLE field from DERIVED Table on the page.
Step 6: On field change of Country Field, write the below code

if YOURRECORDNAME.COUNTRY = "US";
  DERIVED.EDITTABLE = "STATE_US_DVW"; // dynamic view of list of states of US
Else
  DERIVED.EDITTABLE = "STATE_CAN_DVW"; // dynamic view of list of states of CAN
End-if;
Using SQL Text
Instead of creating two views/dynamic views, you can also create one dynamic view and pass the SQL dynamically to change the prompt table.
Step 1: Create and save A Dynamic view
Step 2: Give the dynamic view as a prompt table to the state field.
Step 3: On field change of your country field you can write.

if YOURRECORDNAME.COUNTRY = "US";
  YOURRECORDNAME.FIELD.SqlText = "Select State from MY_STATE_TBL where country = 'US'";
ELSE
  YOURRECORDNAME.FIELD.SqlText = "Select State from MY_STATE_TBL where country = 'CAN'";
END-IF;

HAPPY LEARNING :)

FieldEdit vs FieldChange Event in PeopleSoft

FieldEdit event is more of a validation event used to validate the value entered in a field and throw error/warning if the value is not wh...