Custom EPM Tooltips using Groovy

Groovy is a standard scripting language which is available in EPM applications to allow dynamic customisation in multiple contexts around the system. The availability of groovy is dependent on the EPM licensing; groovy scripting is available for EPM Enterprise applications only.

As with all coding languages, use of the documentation is key and Oracle have provided a brilliant scripting reference which can be found here: https://docs.oracle.com/en/cloud/saas/applications-common/22b/cgsac/groovy-basics.html

In this blog we will focus on using groovy scripting to generate user tooltips, depending on the cell being referenced. Tooltips are the messages that show up for users when the cursor hovers over a particular cell. Depending on the form contents, these can be used to offer more specific guidance and to provide further context for data entry.

In the below example, we will be using groovy to set tooltips which provide additional information on the different forecasting drivers, available to select via smart list. These will appear when the user hovers over the selected driver, e.g. ‘Run Rate – Evenly’, as below.

Before we review the script, here are a few groovy basics:

  • To access groovy, convert your business rule from a calc script to a groovy script using the ‘Script Type’ dropdown in calculation manager
  • Commentary is denoted by a double-slash combination // at the start, or by /* … */
  • If/else statements are used for conditional expressions
  • Switch statements are used to evaluate a condition with many different values, referenced by numerous cases
  • Variables are defined using the def keyword
  • The DataGrid interface allows the POV/Row/Column header cells to be referenced
  • Loops and if statements are encased with curly brackets in Groovy: {}
  • Surrounding a string with single quotation marks (“x”) allows for a single-line string. Using triple quotation marks instead allows for a multi-line string. (“””x”””)

The below script performs the following steps to return a relevant tooltip:

1.       Retrieve the grid information using the getGrid operation

2.       Use dataCellIterator to iterate over all cells in the grid

3.       Check if the Component dimension member is set to “SL_Driver” for the current cell, using the getMemberName command

4.       If so, switch through the four case statements, checking which driver has been selected

5.       For each case, set a tooltip relevant to the selected driver using setTooltip

 

DataGrid curgrid = operation.getGrid() 

//Validate Driver Smart List Selection

operation.grid.dataCellIterator().each{

if((it.getMemberName('Component') == 'SL_Driver')) {

switch(it.data) {

case 0: //Missing Value

it.setTooltip("Please select driver from the drop-down list") 

break; 

case 1:  //Run Rate – Evenly

it.setTooltip("""This driver will average a chosen set of Actual Periods, apply an optional multiplier and put the result into all plan periods evenly.""")

break; 

case 2:  //Run Rate - Actual Profiling

it.setTooltip("""This driver will average a chosen set of Actual Periods, apply an optional multiplier and put the result into all plan periods using the same periodic proportions as the Actuals.""")

break; 

case 3:  //Last Actual Period

it.setTooltip("""This driver will take the latest Actual period value, apply an optional multiplier and put the result into all plan periods evenly.""")

                break;

}}}

Save this script in a business rule with a relevant name, e.g. “Driver_Tooltips” and assign this to ‘Run on Load’ for any forms which utilise the driver smart list. Then whenever a user hovers over a selected driver, the tooltip will provide additional information and improve the user experience! 

Comments

Popular posts from this blog

Executing Smart View Retrievals using VBA

Loading Actuals from Fusion ERP Cloud to PBCS

Loading multi-period row data files using Data Management