Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/12/8647612/html/index.php:4) in /home/content/12/8647612/html/includes/bootstrap.inc on line 1162

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/12/8647612/html/index.php:4) in /home/content/12/8647612/html/includes/bootstrap.inc on line 1162

Warning: Cannot modify header information - headers already sent by (output started at /home/content/12/8647612/html/index.php:4) in /home/content/12/8647612/html/includes/bootstrap.inc on line 726

Warning: Cannot modify header information - headers already sent by (output started at /home/content/12/8647612/html/index.php:4) in /home/content/12/8647612/html/includes/bootstrap.inc on line 727

Warning: Cannot modify header information - headers already sent by (output started at /home/content/12/8647612/html/index.php:4) in /home/content/12/8647612/html/includes/bootstrap.inc on line 728

Warning: Cannot modify header information - headers already sent by (output started at /home/content/12/8647612/html/index.php:4) in /home/content/12/8647612/html/includes/bootstrap.inc on line 729
Lepa's blog | CompShack.com

Lepa's blog

AddToTime PeopleCode Built-in Function

You can use the AddToTime function to add hours, minutes, and/or
seconds to time. This function returns the result as a Time value. To
subtract from time, you can simply use negative numbers. The resulting
is always adjusted such that it represents an hour less than 24 (example: 18:45)

AddToTime(time, hours, minutes, seconds)

So, how does it look like using an example?

%CurrentDateIn Meta-SQL Function

A very useful PeopleCode Meta-SQL function. I will be providing an
example and how %CurrentDateIn function will be resolved at run time.
But first, this is how PeopleSoft explains it:

The %CurrentDateIn meta-SQL variable expands to a platform-specific SQL
substring representing the current date in the Where clause of a SQL
Select or Update statement, or when the current date is passed in an
Insert statement.

And here is an example:

Hide Add Button if a Row Exists on the Grid

I have been working a lot with Grids lately and this is an example on how to hide an "Add" button under the grid so that users can only enter one row.

The comments between the code should explain what I'm trying to do here. But please, don't hesitate to ask if need be!

Local Rowset &RSEthnic;

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

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.

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

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