Category: App Engine

Jethro List: Ctrl + A

This post  is part of my Jethro List.  You can read more about the list on the Jethro List page.

Can I make another suggestion?  Some of the text boxes in App Designer don’t work like regular Windows controls.  Namely, they don’t support things like Control-A to select the entire text in the box.  This is slightly frustrating and also makes App Designer feel antiquated.

One of those places is the File Layout Field Properties dialog.  If you go to the “Field Name” text box, you can press Ctrl+A to select the entire field name easier.  That makes it easy to either copy the name or type a new name in it’s place.

File Layout Field Name

 

If you go to the Field Description box in the lower right hand corner, you will find that Ctrl+A doesn’t work.  You have to either use the mouse or hit Home, Shift + Ctrl + End.

File Layout Field Description

 

On a rabbit trail, the file layout UI could use some attention.  A feature that I would like for Flat Files is the ability to sort by the Start Position.  If you come behind someone who wasn’t as organized and didn’t put the fields in order, it can be annoying.  Also, file layouts seem to have issues with caching.  I have had many a time that I changed a file layout and saved only to reopen it and find my changes missing.

The Application Engine UI has a similar problem.  The descriptions for the sections, steps, and actions all don’t allow the use of Ctrl + A.

App Engine description fields

In conclusion, I think it would be helpful if Oracle could update the App Designer UI to match the standard features that we have come to expect in Windows applications.  I can live with it this way and can get my job done, but it sure would be nice to have a nicer feel to development.

 

Jethro List: Disable Restart

For my first item on the Jethro List, I want to suggest changing the default on the “Disable Restart” option for an Application Engine program.  I think it should be checked by default.

Just to introduce the Jethro List: these posts are a list of good influences on the PeopleSoft world that I would like to make.  Hopefully, they are good suggestions that I would love to get noticed and implemented.  We’ll see if it goes anywhere.

So, what about the Disable Restart option?

The default right now as of PeopleTools 8.52 is that the Disable Restart is unchecked.

The problem is that the first time your new program abends or crashes, you have extra work to do.  You have to either restart the same process instance or delete the AERUNCONTROL row.  You can see the PeopleTools Tip — App Engine Restart If you get … post for more info on fixing the problem.

Why should it default to checked?  Because you have to design a program to be restartable before the user should be able to restart it.  Here are some of the changes that you need to make:

  • Control the Commits: The program will restart at the last commit.  So, you need to pay attention to where you have the program commit.  I believe that when left alone, it will only commit at the end.
  • Set the Do Select types: The default Select/Fetch will fail if the program crashes in the middle of the selection.  You need to choose either Restartable or Reselect.
  • Track the Progress: The program needs to save which row it is processing so that it can restart at the same place.  You either need to add a processed flag to each row, or save the last row processed where you can process only rows greater.

So, that’s why I wish I could change this default option.

Basic Steps to Create an Application Engine in PeopleSoft

In reviewing my statistics, I found that one common search was “basics steps to create an appengine in PeopleSoft”.  I hope the person(s) found what they were looking for on my blog.  Nonetheless, that gave me the idea to write a simple overview on creating a new Application Engine program.

This post can’t cover everything but I do plan to cover:

  • Creating a new Application Engine definition
  • Setting program properties
  • Understanding program flow
  • Inserting new sections, steps, and actions
  • Loops/logic
  • State records
  • Adding programs to projects
  • Where to go from here

Read More

Finding Data in Temp Tables

Here’s a simple little trick for Application Engines that have Temporary Tables assigned.

When you have temporary tables, you don’t know for sure which Temporary Table it is using.  You could write a quick select and change the number on the end until you find the one you are looking for, but here is a slightly quicker method.

Note: This is designed for Oracle, but you could easily change it up to work with SQL Server.

First, build a select statement that will list all of the tables.  We’ll assume our Temporary Table Record is MY_TEMP_TAO.  You can substitute with your specific record.

[sourcecode language=”sql”]
SELECT ‘UNION SELECT ”’ || TABLE_NAME || ”’ TBL, A.* FROM SYSADM.’ || TABLE_NAME || ‘ A’
FROM DBA_TABLES
WHERE table_name LIKE ‘PS_MY_TEMP_TAO%’;
[/sourcecode]

Update (thanks to Nicolas): You can avoid having to remove the first UNION if you use something more like this:

[sourcecode language=”sql”]
SELECT ‘SELECT ”’ || TABLE_NAME || ”’ TBL, A.* ‘ ||
‘FROM SYSADM.’ || TABLE_NAME || ‘ A’ ||
case when count(*)over()=rownum
then ‘;’ else ‘ UNION ‘ end
FROM ALL_TABLES
WHERE table_name LIKE ‘PS_MY_TEMP_TAO%’;
[/sourcecode]

The output should look something like this:

[sourcecode language=”sql”]
UNION SELECT ‘PS_MY_TEMP_TAO’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO A
UNION SELECT ‘PS_MY_TEMP_TAO1’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO1 A
UNION SELECT ‘PS_MY_TEMP_TAO2’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO2 A
UNION SELECT ‘PS_MY_TEMP_TAO3’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO3 A
UNION SELECT ‘PS_MY_TEMP_TAO4’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO4 A
UNION SELECT ‘PS_MY_TEMP_TAO5’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO5 A
UNION SELECT ‘PS_MY_TEMP_TAO6’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO6 A;
[/sourcecode]

You just simply need to delete the first Union to make something like this:

[sourcecode language=”sql”]
SELECT ‘PS_MY_TEMP_TAO’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO A
UNION SELECT ‘PS_MY_TEMP_TAO1’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO1 A
UNION SELECT ‘PS_MY_TEMP_TAO2’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO2 A
UNION SELECT ‘PS_MY_TEMP_TAO3’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO3 A
UNION SELECT ‘PS_MY_TEMP_TAO4’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO4 A
UNION SELECT ‘PS_MY_TEMP_TAO5’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO5 A
UNION SELECT ‘PS_MY_TEMP_TAO6’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO6 A;
[/sourcecode]

If you know your temp table has the process instance as the key and you know the one you are looking for, you could do something like this:

[sourcecode language=”sql”]
SELECT * FROM (
SELECT ‘PS_MY_TEMP_TAO’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO A
UNION SELECT ‘PS_MY_TEMP_TAO1’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO1 A
UNION SELECT ‘PS_MY_TEMP_TAO2’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO2 A
UNION SELECT ‘PS_MY_TEMP_TAO3’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO3 A
UNION SELECT ‘PS_MY_TEMP_TAO4’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO4 A
UNION SELECT ‘PS_MY_TEMP_TAO5’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO5 A
UNION SELECT ‘PS_MY_TEMP_TAO6’ TBL, A.* FROM SYSADM.PS_MY_TEMP_TAO6 A;
) Z WHERE PROCESS_INSTANCE = 12345
[/sourcecode]

Explorations in Component Interface: Handling Component Interface Errors

This is a continuation of the following posts:

The plan this time is to try to see how well we can handle errors.  I have been having trouble with some of my production programs crashing when I have taken all the necessary steps to trap and handle the error.  So, we’ll see how this goes …

Read More

Explorations in Component Interface

This is part one of a multi-part series exploring some quirks in using Component Interfaces with Application Engine programs.  If nothing else, hopefully, these will give new developers some insight into how to use a Component Interface.  My goal is to expose a bug in the Application Engine tool that maybe Oracle will see and fix.

This first part will simply walk you through creating a Component Interface.  This part is just a map to associate the fields on the screen (or really in the component’s buffer) with an API property that can be accessed with code.

First, we create a new definition in Application Designer.  You can either use the Ctrl + N keyboard shortcut or the File > New menu.  Choose Component Interface from the list:

New Object List in App Designer

Next, have no fear — you will see the open dialog making it look like you want to open a component.  Really, Application Designer is just asking you which component you want to map.  In this example, we will use the “PERSONAL_DATA” component, which is the Modify a Person screen (Workforce Administration > Personal Information > Modify a Person):

Pick the Component

Next, Application Designer asks you if you want to default the properties.  I almost always say yes to this questions because it will make Application Designer do all the work for you in generating the map.  The properties will be given names based on their field names in the buffer:

Yes to Default the Properties

Now, you should have a new component interface generated for you.  Notice that the left side is the Component Structure.  It is the same as the Structure tab on the Component itself.  The right side is the map of record/field to property name.  In this screenshot, I have the component open in the background and I drew a line to show how the structure is the same.  Then, I drew a line from the structure to the property generated for one of the fields:

How the fields map to properties

Finally, save the component interface.  You can either use the Ctrl + S keyboard shortcut, or you can use the File > Save menu.  I gave it the name BLG_PERS_DTA_CI.

Save Dialog

While your at it, you may also want to add it to the project.  You can use the F7 keyboard shortcut or the Insert > Current Definition Into Project menu.

This concludes creating the Component Interface.  Please stay tuned for the next steps …

Step-by-Step: App Engine for Testing PeopleCode

This is a how-to post that I intend to refer back to from time to time.  The goal is to create a simple Application Engine program into which we can drop some PeopleCode and see how it works.  Assuming we don’t need any of the online pieces, this is much easier than going through all of the steps to create a page and register it so we can see it online.

Step 1: Create a new Application Engine Program

In Application Designer, click Ctrl + N or use the File > New menu option.  This will open the “New” dialog, and you can choose Application Engine program from the list.

You new program should look like this:

Step 2: Disable Restart

This step is very important.  If you don’t disable the restart and your program crashes, you will have to go through a few extra steps before you can rerun it.

First, click on the properties button while your program is in focus (you can also use the File > Definition Properties menu):

This should bring up the Properties dialog.  Then, go to the Advanced tab.  Check the “Disable Restart” option.

Step 3: Add an Action

First, click on the “Step 1” step to select it.  I usually click anywhere in the gray, and this should turn it black.

Next, click on the Add Action button, or you can use the Insert > Action menu.

Finally, change the type from SQL to PeopleCode.

Step 4: Save the program

At this point, you need to save before you can add PeopleCode.  You can use Ctrl + S, click on the Save icon on the toolbar, or you can use the File > Save menu.

Step 5: Enter the PeopleCode

First, open the PeopleCode program by double clicking anywhere on the gray of the PeopleCode action.  Or, you can right click on it and choose the “View PeopleCode” option.

Next, you will probably want to open a file to show output from your PeopleCode testing.  You can use this PeopleCode:

Local File &log;
&log = GetFile("c:\temp\log.txt", "W", "A", %Filepath_Absolute);

Then, you can print to that file with the writeline() method.  For now, we will just print Hello, World.

&log.WriteLine("Hello, World!");

Finally, you will probably want to close your file:

&log.Close();

Here is what it all looks like:

Make sure to save once you make these changes.

Step 6: Run the Program

Again, after you have saved, go back to the main program window where you can see the Main section, Step 1, and your new PeopleCode action.  Then, click the run icon.

In the dialog, Check the Output log to file and uncheck Run Minimized.  The output log to file allows you to see what happened.  Otherwise, the window will close before you see what happened.  The run minimized isn’t a big deal, but if the program doesn’t run minimized you see it pop up and go away better.  When the program goes away, you know it is done running.

Finally, when it is done, check the output.  If you used the paths that I did your output should be in the c:\temp directory.  You should have two files.  The first, is the main output from the program.  Check this to make sure the program ran to success:

The second is the log that your PeopleCode created.  For now, it should just say, “Hello, World”.