PeopleCode

Restrict Xlat Values in a Drop Down List

As you can see from the picture below, I have prevented the Xlat value of "BUSN" to appear in the dropdown list although it is an active value on the Email Type Field. See the PeoleCode below to accomplish such a task.

PeopleCode to restrict Xlat Values

Delete Grid Blank Rows Entered by Users When Saving

Sometimes users click the "+" on the grid to enter data but end up
clicking it more than once and getting some extra empty rows in the
gird. The peopleCode to get rid of any extra empty grid rows when the
user saves is as follows:

Hide a Row in a Grid or Scroll Area Using PeopleCode

The picture below shows a gird with 2 rows, one of Address Type "Home" and the other with Address Type "Mailing". I would like to hide rows on the grid that have anything other than Address Type "Home":

Grid before peoplecode hide

Now what I would like to accomplish is this:

Hide a Grid Column From a Grid in PeopleCode

This code should be helpful if you are trying to hide a grid column using PeopleCode

To
hide a column in a grid (using the Grid and GridColumn objects). You no
longer must loop through every row in the grid and hide that field. Now
you can use the GridColumn property Visible. The Visible property will
also hide grid columns that are displayed as tabs in the PeopleSoft
Internet Architecture.

Flush Unwanted Grid Rows Using PeopleCode

In one of my previous posts; I showed you how to populate a grid
using a record or view and a "where" clause. But, what if you want to
narrow the data on the grid depending on what the customer wants to see.

Example:
Lets say you have a grid that shows PTO balance for your employees. The
page the customer is using have a check box that if checked will narrow
the grid data to only show "Negative" PTO balances. This is how you go
about doing that:

PeopleCode Bypass Search Page by Role

Sometimes you would like to bypass the search page depending on the
user's role. For some users, they need the ability to look at other
employee’s time sheets, managers for example. However, for others, they
should only be restricted to their own data. Below is PeopleCode
example that will bypass the search page depending on users' role.

Read Data From Table or Views into a Rowset Object

Grids are used all the time in PeopleSoft, and to populate them with
dynamic data could be quite challenging. Use the "Select" function to
read data from the database tables or views into either a row or rowset
object.

The following example first flushes the hidden work
scroll, then selects into it based on a field on the page, or any
criteria that you add to the “where clause”.

FetchValue & UpdateValue PoepleCode Functions

In order to reference the value of a field within a looping statement, the FetchValue and UpdateValue build-in functions can be used.

  • FetchValue(SCROLL.record_name, target_row, [recordname.]fieldname)
  • UpdateValue(SCROLL.record_name, target_row, [recordname.]fieldname), value)

Example:

Porcessing Rows Using Loops (ActiveRowCount)

In order to loop through the rows on an occurs level you need to
know the number of rows. ActiveRowCount returns the number of active
rows in a scroll.

For &I = 1 To ActiveRowCount(Scroll.PSU_STU_ENROLL)
/*your statement goes here*/
End-For;

Difference Between MsgGet, MessageBox, & MsgGetText PeopleCode Functions

Wondering why there are 3 different functions or ways to get text
from a message catalog? Check the comparison below and decide which one
best fits your needs.

MsgGet(message_set, message_num, default_msg_txt [, paramlist])
The MsgGet function
retrieves a message from the PeopleCode Message Catalog and substitutes
in the values of the parameters into the text message.
Example: &MsgText = MsgGet(30000, 2, "Message not found");