Lepa's blog

Display Only the Last 4 Digits of a Social Security Number

The PeopleCode below will only display the last 4 digits of a social security number. I have placed the code in a Component PostBuild event and it works perfect.

DERIVED_HR.SOCIAL_SECURITY_NUMBER = Replace(DERIVED_HR.SOCIAL_SECURITY_NUMBER, 1, 7, “XXX-XX-);

Here, I’m using the replace PeopleCode built-in function. The functions takes the value from a the above field, starts at position 1 and replaces the 1st 7 characters with the string “xxx-xx-”.
The result:
After this code gets executed, SSN on a page should show up as xxx-xx-5623

Delete a File Using PeopleCode

It is always a good idea to check for a file if exists before trying to delete it. So the code below will check for that and then will attempt to delete the file if found. The delete is performed using the build-in peoplecode function DeleteAttachment.
The code below also checks for the returned code by the function to verify whether the file has been deleted or not.
&retcode = DeleteAttachment(URL.BKFTP, ATTACHSYSFILENAME);
If (&retcode = %Attachment_Success) Then
MessageBox(0, “File Attachment Status”, 0, 0, “DeleteAttachment succeeded”);
UnHide(ATTACHADD);

Hide a Group Box on a Page Using PeopleCode

To hide a group box and all the fields placed in it on a PeopleSoft page use the code below in a page “Activate” event.

HR_LBL_WRK.STATUS_LBL.Visible = False;

Where HR_LBL_WRK is the record name, and STATUS_LBL is the field record. Double click on the Group Box to see its record properties (1st tab).
For the Group box and all the fields in it to be completely hidden, make sure the “Hide Border” and “Adjust Layout for Hidden Fields” on the Label tab are checked and the “Hide all Fields when Group Box Hidden” on the Use tab is also checked.

Check Email Address and Type on a PeopleSoft Grid

The grid looks like this:

PeopleCode to restrict Xlat Values

What I would like to accomplish is every time the user adds a new email address i would want to check for the following:
1. Check for blank email type
2. Edit to check for '@' character
3. Check if email address is blank
4. Check for duplicate email type in the same grid

Using Hyperlinks in Queries to Drill Down to Individual Values

I came across a PeopleSoft posting written by Rob's PeopleSoft Blog and could not help but to post it on my blog. It is a neat trick and I'm sure will come handy in many occasions!

Download Oracle OpenWorld 2007 Session Presentations

Every year, Oracle makes the Openworld session presentations available for public in a PDF format. Click here to take a look at what is available for you to download.

SQL to Check PeopleSoft Process Name Status

Run this SQL on a particulare process name to get it's process status form PeopleSoft process request.

SELECT a.prcsname, a.oprid, a.servernamerun, b.xlatlongname AS STATUS,
a.rundttm,
TRUNC (MOD ((a.enddttm - a.rundttm) * 24, 24)) "Hr",
TRUNC (MOD ((a.enddttm - a.rundttm) * 24 * 60, 60)) mi,
TRUNC (MOD ((a.enddttm - a.rundttm) * 24 * 60 * 60, 60)) sec,
a.prcsinstance, c.outputdir
FROM psprcsrqst a, xlattable b, ps_cdm_list c
WHERE b.fieldname = 'RUNSTATUS'
AND b.fieldvalue = a.runstatus
AND a.prcsinstance = c.prcsinstance
AND a.prcsname = 'YourProcessName'

Adding a Sub Record Field into a Grid or Scroll Area

I kept getting this weird PeopleSoft error when trying to drop a sub record field into a Grid or Scroll area on a page. The error was this:

Fields from subrecords are not allowed to be inserted directly into the page. Use Subpage instead.

What? You have to be kidding me! I know this could be done and I don’t need a subpage for this. I’ve seen it done and I’ve actually got it done! This is what I did.

Oracle Open World

I will be in San Francisco, CA this coming week attending Oracle Open world. I've heard lots of good things about this event from other colleges so I'm looking forward for it.
I have lots of sessions to attend, will be busy. But I will make sure to put some time aside to enjoy San Francisco!

Use htaccess to Manage your PHP File Extensions

I have been using Godaddy share hosting for a while now with no problems. But things start getting a little shaky when I decided to give Joomla and Drupal (a powerful CSM) open source software a try to replace my WordPress blog.