Tuesday, 23 April 2019

Drop Zones and HCM Image 030

HCM Image 030 was released on 19 April and with it the first set of Drop Zone enabled pages.

What is a Drop Zone?

The "Zone" is one or more areas on a delivered page defined by Oracle developers into which customers can insert their own subpages using configuration. It's an "Isolating Customisation" tool along with the likes of Event Mapping.

Why have Drop Zones?

The purpose is to provide a mechanism whereby a delivered page can be modified without actually customising it. Dynamically injecting your subpage into the delivered page, through configuration rather than customisation, will neutralise the impact making it much easier in the future to take updates from future Images.

Some Things to Know


  1. Drop Zones are added to delivered pages by Oracle. Customers should not add the Drop Zones themselves . If you do then you'll be customising the page and that defeats the objective of Drop Zones. If you want access to the pages which contain Drop Zones then you need to apply the required updates from PI 030.
  2. Subpage are created by the customer in Application Designer. Nothing particularly special about these subpages and you can place all the usual fields, buttons, frames, group boxes, etc.
    • Fields added to your subpage become an intrinsic part of the component buffer at runtime.  This is a powerful feature especially when combined with Event Mapping.
    • The Drop Zones exist at Level 0.  Any tables added to your subpage will appear at this level and will be automatically saved and updated by the component processor in the usual manner.
    • Grids and Scroll areas can be added to your subpages but you must add a Horizontal Rule object at the end of your subpage to reset the Level back to 0.
    • Read more here on Considerations for Creating Dynamically Injected Subpages
  3. These subpages are "Dropped" into the "Zones" using a configuration entry in page PeopleTools > Portal > Configure Drop Zones.
  4. Delivered pages have initially been redesigned to include Zones at the top and bottom of the page. Full list of pages can be found in Doc ID 1917096.2
  5. Drop Zones are currently only available on Fluid pages. It's possible that Classic pages will adopt this new feature but if you know anything about the Table heavy method of control page layout in Classic you'll know how challenging this might be.

Strategy for Adopting Drop Zone

There are a number of pre-requisites for using Drop Zones:

  • You need to be on PeopleTools 8.57 
  • You need the Drop Zone enabled pages from PI 030 (NOTE: If you take the Drop Zone enabled pages but you're on a tools release lower than 8.57 then the pages will still work. The Drop Zones are simply ignored).
  • In the process of applying the Change Package from PI 030 you may find you have customisation impacts to resolve. Your options are:
    • Remove the customisation as it's no longer needed.
    • Re-apply the customisation.
    • Re-design the customisation using Drop Zones and/or Event Mapping.

Using Drop Zones in re-designing a customised page may require you to rethink some aspects of the user interface. Drop Zones generally only exist at the Top and Bottom of the pages and so you'll need to look at grouping together your custom fields. Drop Zones won't solve requirements such as inserting custom fields into delivered grids or scroll areas. Design constraints will require compromise from your business users but the rewards will be faster application of maintenance and reduced cost of ownership.

Having said that "if you can make money, save money or improve customer service quality by customising then go ahead and do it - customize. Why wouldn't you try and get the most out of your investment?" I blogged on this idea here and discussed with Dan, Kyle and Jim at OpenWorld 2018 (listen in at 00:30:50 on the psadmin.io podcast).

So... back to HCM 030 and Drop Zones

Let's take an example from HCM 030 and setup a custom subpage to work with the Employee Self-Service Personal Details Address page (See Fig.1 ).  There are 3 Drop Zones defined on this page and of course you can't see them visually on the page as we have not dropped anything into them yet.
Fig.1 Delivered Address Page

I've created a very simple test subpage to help locate the Drop Zones (See Fig.2 ).
Fig.2 Test Subpage

If we open the Configure Drop Zones page and lookup HR_EE_ADDR_FL Component we see there are 3 sets of Drop Zones;

  • Top and Bottom of the Edit Page (the secondary page that opens when editing Addresses)
  • Top and Bottom of the Lookup Page
  • Top, After Home and Bottom of the Address Page (see Fig.3  )


  • Fig.3 Configure Drop Zone Page
It's not immediately obvious which Drop Zone is which so I'm going to use my test subpage for all of them and see what happens.  (NOTE: For some reason erroneous double rows are being pulled into this page for the secondary page Drop Zones.  I patched my PeopleTools to patch 06 but this didn't resolve it).

Fig.4 App Designer Page Definition showing 3 Drop Zones
See Fig.4  for the Application Designer view of the 3 Drop Zones on the main Addresses page.  It may be necessary to use Application Designer to understand Component structure, Page layout and PeopleCode logic.

The result can be seen in in Fig.5. It's not necessary to clear cache. Just reload the component and like all App Designer changes the effect is immediate.

Fig.5 Results of dynamically injecting subpages into Drop Zones

Conclusion

This is a powerful evolution of PeopleTools and has, once again, beautifully capitalised on the meta data based nature of PeopleTools.  If we combine the power of Event Mapping with Drop Zones we should be able to implement even more value adding change without costly and invasive customisation.

As always feel free to comment with thoughts and suggestions.

Thursday, 18 April 2019

Suppress Logs in Loop - New Trace in 8.57


New in PeopleTools 8.57 is a trace flag you're going to wonder how you ever managed without. (and before you ask...no... this is not an April Fools joke .  This really is a new feature in 8.57.)

Suppress Logs in Loop - It does exactly what it says it does.  It suppresses trace output for PeopleCode loops.

How does it work?

Here's some sample PeopleCode designed to show the new trace flag behaviour.
For &i = 1 To 100
   &a = &a + 1;

   For &j = 1 To 10
      &b = &b + 1;
   End-For;
   
End-For;

WinMessage(&a | ", " | &b);

With the the Suppress logs in loop flag OFF we get 3,409 lines of trace file showing 100 iterations of the first loop and 1,000 iterations of the second loop.


With the Suppress logs in loop flag ON we get a much more readable trace file.

But how useful is this?  Well, to get a quick, easy to read picture of a complex set of functions or class method calls that are nested in a set of crazy loops then this is VERY helpful.  But what if we're troubleshooting a behaviour issue? Let's modify our PeopleCode to include a test in the outer loop which will only evaluate TRUE once.
For &i = 1 To 100
   &a = &a + 1;
   
   If &a = 2 Then
      &s = "&a has reached the 2nd iteration " | &a;
   End-If;
   
   For &j = 1 To 10
      &b = &b + 1;
   End-For;
   
End-For;

WinMessage(&a | ", " | &b | ", " | &s);

With the Suppress logs in loop flag ON we get an incomplete trace.  Clearly, our code which sets &s is executing but we can't see it in the trace below.

The reason for this is that the trace only logs the first iteration.  It's by design.  Imagine how complex it would be for the trace engine to retrospectively include trace if a condition evaluated differently from one iteration to the next.



Despite this.... I still think this is a very useful feature... and so.... thank you PeopleTools team.

Read more here  in PeopleTools Online https://docs.oracle.com/cd/F13640_01/pt857pbr2/eng/pt/tsvt/task_ConfiguringPeopleCodeTrace-0710ed.html#ContentsNavBar

Monday, 1 April 2019

Undocumented Useful PeopleCode Functions

Those of us that have been working on PeopleSoft for a while know that we occasionally stumble across undocumented features and functions.

Logical Operators are one of the fundamental building blocks of computer programming languages.  Evaluating if a predicate (or expression) is logically false or true determines program flow and results in correct and predictable behaviour.  The 3 Logical Operators in PeopleCode (sometimes called logical connectives) are AND, OR and NOT

In this example the Boolean typed variable &foo must be True and variable &bar must be False in order for this predicate to be True.  (In the Truth Table a False and False (i.e. Not False) always returns True).
   If &foo And
         Not &bar Then
         
         /* do something... */

   End-If;

I've been working on a software project recently and I stumbled upon a new logical operator in PeopleCode.

I found the Maybe operator.

The beauty of this operator is that the evaluation of a Boolean using the Maybe operator might return a False or True but you're never quite sure which.   In this example &foo must be True and variable &bar could be False or True.  The result of the Maybe operator may result in True or may result in False.
   If &foo And
         Maybe &bar Then
         
         /* do something... */

   End-If;

This simple device can save us writing loads of quite complex code and that makes it a very powerful operator indeed.

There are many other useful shorthand functions we can use for evaluating field values and I'm particularly fond of  the functions AllNoneAllOrNoneOnlyOne and OnlyOneOrNone.  You can read all about there here in the PeopleSoft Online Documentation.

To check if a field has a value we could write
  If &foo <> " " Then
      
  End-If;

or we could simplify this with...
  If All(&foo) Then
      
  End-If;

This is particularly useful if you need to evaluate more than one field. So the following...
   If &foo <> " " And
         &bar <> " " And
         &dee <> " " Then
      
      /* All fields must have a non empty value */
      
   End-If

would become a nice tidy....
   If All(&foo, &bar, &dee) Then

      /* All fields must have a non empty value */
      
   End-If;


And our newly discovered Maybe operator also works as a Function too.  We can therefore return True or Maybe False if &foo has a value.
   If Maybe(&foo) Then
         
         /* do something... */

   End-If;

Happy coding. And if you too come across any hidden functions please let me know.