How to Add Items to a Drop Down List?

The PeopleCode below will do couple things. First, it will restrict grid on a page to show only rows of address type "HOME". Second, allow users to only be able to add a "Home" mailing address by restricting the values in the drop down list to show only "Home" by using the ClearDropDownList and AddDropDownItem properties.

/* Hide Rows on the grid for any thing that is not of Address Type "HOME" */
FOR &i = 1 TO &Level1.ActiveRowCount
   IF &AddrType <> "HOME" Then

PeopleSoft Object Types Explained

If you ever queried PSPROJECTITEM table (stores PeopleTools project objects) then you have definitely noticed that object types are stored as a number and not with their names. For example, if you have a project with a component then your component on this table will be stored as object type number 7.

So, what are other object types stored as (Pages, Record PeopleCode, Menus....)? Well, the list below is your answer. Please don't hesitate to post a comment and "correct" me if I messed up somewhere while mapping numbers to names!

0 = 'Record'
1 = 'Index'
2 = 'Field'

How to Read a File Using SQR?

Here is some SQR code that will enable you to read a file. The code will also track # of records being read and will print out how many records have been rejected as well as total records read.

! Procedure: Read-Input-File !
! Descr:     Read file               !
Begin-Procedure Read-Input-File
#debug show 'Entering Read-Input-File'

Read 1 into $Record:3000  !skip the headings

Move 0 to #Tot_Recs
Move 0 to #Recs_Rej

While Not #end-file
        Read 1 into $Input:3000 Status=#Read_stat

Oracle CASE Expressions

I have used Oracle CASE in one of my previous articles and this is an attempt to explain how it works.

CASE expressions let you use IF ... THEN ... ELSE logic in SQL statements without having to invoke procedures.

Here is a simple CASE example from Oracle documentation:

Extract Project Objects Using an SQL

There have been times where I needed to document objects included in an Application Designer. The process could get very time consuming if you have a project with hundreds of PeopleSoft objects in it. PeopleSoft doesn't provide a "copy paste" type of approach to ease things, so I came up with my own!

The query below will return all the objects inside of an Application Designer project. You can then copy the rows and paste them where ever you'd like.

WHEN 1 THEN 'Index'
WHEN 2 THEN 'Field'
WHEN 3 THEN 'Field Format'

Close an Open File Using SQR

Here is an SQR code to close a file that has been opened for reading. Check my other article if you would like to see how to open a file for reading using SQR.

! Procedure: Close-File       !
! Descr:     Close a file that !
! has been opened for reading.!
Begin-Procedure Close-File
#debug show 'Entering Close-File'

If $file_open = {TRUE}
    close 1
    Move {FALSE} To $file_open
    Show 'File ' $your_file_name ' Closed successfully.'

Query for Component Path within PeopleSoft Portal

While back, I've created an SQL to find the exact same thing but with some level limitations. I have came across another query written by Jim's PeopleSopft Journal blog that works a little bit better and thought to share it with my visitors.

Jim's query however requires the developer to know the content reference of a component before the query could be used. What I really wanted is the ability to find the path by just knowing the component and not the content reference. Chances are, if you know the component reference you know the path to that component as well. So, to find the component path without knowing the content reference, follow the steps below:

1) Run the below SQL to get the content reference name for your component

FROM psprsmdefn

-- Replace :1 with the component name you are looking for.

Find Component Path Within PeopleSoft Portal

Update: You might want to check my new post to find the path with no level limitations.

PeopleSoft Portal Link as an External URL

I had fun trying to figure this one out at work today. I wanted to
associate a link in PeopleSoft Portal to open an external URL (website)
in a new window and without the portal frame (template) around it. To
do so, follow the steps below:

Navigate to PeopleTools >
Portal > Structure and Content. Chose the folder you would like your
link to be in or you can add a new folder just for this new link if
you'd like.

Now scroll all the way to the bottom and click "Add Content Reference".

Run an SQR From a PeopleSoft Application Engine

Here is a good sample of how to launch an SQR from within PeopleCode. You can use the peoplecode function called “ScheduleProcess”. Here is the example:

&PROCESS_TYPE = "SQR Report"; (or "SQR Process")

If &RC != 0 /*"1" = client "2" = server*/
Winmessage("Error: Error Scheduling SQR Process, RC = " | &RUN_CONTROL);