Welcome
Thank you for joining this Oracle Cloud
Customer Connect live event.
This webcast will start in a few minutes.
Live Q&A
There will be a live Question and Answer (Q&A) session
following the presentation. If you have any questions, you can
ask them using the Q&A functionality in Zoom. Questions will
be answered in the order received.
The event replay and the slides will be available within one
business day on Oracle Cloud Customer Connect.
Oracle Planning
Introduction to Groovy Business Rules in Planning
Name
Suruchi Sood,
Principal Technical Support Engineer, Oracle
May 2024
Safe harbor statement
The following is intended to outline our general product direction.
It is intended for information purposes only, and may not be
incorporated into any contract. It is not a commitment to deliver
any material, code, or functionality, and should not be relied
upon in making purchasing decisions. The development, release,
timing, and pricing of any features or functionality described for
Oracle’s products may change and remains at the sole discretion
of Oracle Corporation.
3 Copyright © 2024, Oracle and/or its affiliates May 2024
Objective
Your first Introduction to Groovy Rules
• Create context-specific, dynamic business rules
• Dramatically improve the performance of calculations and data movement in your application
• Perform “intelligent” calculations – trigger the calc only for the changed cells/rows
• Create color coding data validations for web forms
4 Copyright © 2024, Oracle and/or its affiliates May 2024
Agenda
• What is Groovy
• Groovy Basics
• Groovy in EPM Cloud
• Types of Groovy Rules
• Create and Launch Groovy rules
• Demo
• Learning Resources
• Q&A
5 Copyright © 2024, Oracle and/or its affiliates May 2024
What is Groovy
6 Copyright © 2024, Oracle and/or its affiliates May 2024
What is Groovy
Groovy is an agile, dynamic language for the Java platform that combines smooth Java integration with
the benefits of Java performance.
Many features of Groovy are inspired by languages like Python, Ruby, and Smalltalk, making them
available to Java developers using a Java-like syntax.
Groovy has been adopted by many large and small companies, including Oracle, IBM, and SAP, for its
powerful features of both static and dynamic language, securability for cloud environments, and
domain-specific languages.
7 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy Basics
8 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy and Java Framework
Groovy is an object -oriented language which is based on Java platform.
Hands on experience of Java or any other object-
oriented programming language will be helpful when you code in Groovy.
Groovy supports some of the fundamental Java concepts:
Object, Class, Package, Interface.
Support for both static and dynamic typing.
Support for operator overloading.
Native syntax for lists and associative arrays.
Native support for regular expressions.
By default, Groovy includes the following libraries in your code, so you don’t need to explicitly import them:
java.lang.*, java.util.* java.io.* ,java.net.* , groovy.lang.*, groovy.util.* , java.math.BigInteger , java.math.BigDecimal
9 Copyright © 2024, Oracle and/or its affiliates May 2024
:
Groovy Closures
Closure is a powerful and flexible feature that represents a block of code that can take parameters,
execute code, and return a value.
Closure definition:
Examples of Closure definitions:
10 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy each() Method
The each() method is a common method in Groovy that can be applied to various data structures
such as lists, sets, and maps.
The method takes a closure as a parameter and applies it to each element in the collection.
11 Copyright © 2024, Oracle and/or its affiliates May 2024
Getters and Setters in Groovy
In Groovy, getters and setters form what is called a "property" and offers a shortcut notation for
accessing and setting such properties. So instead of the Java-way of calling getters / setters, you can
use a field-like access notation as shown below:
Getting a dimension in Java:
Dimension employeeDim = operation.getApplication().getDimension("Employee")
Member employee = getRtps().get("Employee").getMember()
Getting a dimension in Groovy:
def employeeDim = operation.application.getDimension("Employee")
def employee = rtps.Employee.member
12 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy in EPM Cloud
13 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy in EPM Cloud
Groovy is a EPM Cloud Platform Feature. Groovy in EPM Cloud Platform is available with EPM
Enterprise Cloud along with Enterprise PBCS and PBCS Plus One.
• Planning (including these application types: Custom, Module, FreeForm, Sales Planning, and
Strategic Workforce Planning)
• Enterprise Profitability and Cost Management
• Financial Consolidation and Close
• FreeForm
• Tax Reporting
Planning is one of the use cases of Groovy, it applies to Freeform and other business processes as
well. Groovy is a major difference from Essbase for Freeform use cases where it is very applicable
14 Copyright © 2024, Oracle and/or its affiliates May 2024
:
Current Limitations in EPM
• Performance issues due to static nature of business rules.
Unable to calculate modified members, except for the run-time prompts.
Unable to calculate only the members on the form, when suppression is on.
Examples -
15 Copyright © 2024, Oracle and/or its affiliates May 2024
:
Limitations cont’d
• Unable to validate run time prompt values and alert the user
For example : Email Address that does not have an @ sign
Member already exists in the Essbase outline /Expenses are above a threshold
• Unable to tie different EPM/Planning functionalities in a rule or rule set.
Integration use case (smart push after running calc).
• Custom targeted calc scripts based on the current form.
• Only simple calculations allowed on ASO
16 Copyright © 2024, Oracle and/or its affiliates May 2024
Use Cases Solved by Groovy Scripts
• Advanced Validations
• Lookup Salary and Bonus for different employee grades from a driver cube and validate
employee data being entered in data entry cube against the Salary and Bonus from the driver
cube.
• Generate focused calc scripts at run time based on context other than the RTPs
• Dynamically generate FIX statements with varying dimensionality due to enabling of new
features.
• Calculate Expenses for projects only for the duration (start and end dates) of the project.
• Trend based calculation in Financials – Restrict the calculation to the accounts available on the
form. The same calc can then be used for various forms in Revenue, Expense, and Balance Sheet
& Cash flow. This allows for optimization of calc & reuse.
• Calculate product revenue only for edited products.
17 Copyright © 2024, Oracle and/or its affiliates May 2024
Use Cases Continued
• Validate RTP values before the dynamic members are created
• Add a new employee in the outline only if the provided name, address and phone number are valid.
• Various integration scenarios
• Perform calculation in BSO cube and then push data to ASO for reporting using Groovy rules within a rule set.
• Push data between Strategic Modeling and Planning.
• Use cases calling REST APIs from Groovy script:
• Integrate data between Planning, FCC and ERP Cloud.
• Update metadata from EDM to Planning Cloud.
• Load data from DM to Planning Cloud across PODs.
• Call external REST APIs e.g. Google Maps API to validate addresses.
• Perform complex allocations in ASO.
18 Copyright © 2024, Oracle and/or its affiliates May 2024
Use Cases Continued
Dynamically specify the parent for dynamic members added on the fly
Dynamically determine the parent for a given project type (RTP) and add the new project under it.
Automate many repeatable tasks
By executing various EPM Automate commands via an EpmAutomate instance
returned by the getEpmAutomate() method.
Enter data in upper level time period members and spread back to lower level members
19 Copyright © 2024, Oracle and/or its affiliates May 2024
Java API Reference for Groovy Rules
20 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy – JavaDocs
21 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy Examples
Example Groovy Scripts
Use the example Groovy scripts provided here to see the syntax and power of the EPM Groovy
object model.
https://docs.oracle.com/en/cloud/saas/enterprise-performance-management-
common/groov/groovy-examples.html
22 Copyright © 2024, Oracle and/or its affiliates May 2024
EPM Groovy Scripting APIs
The EPM Groovy scripting APIs allow Groovy scripts to perform a variety of operations
against the EPM object model.
In most cases, the entry point to the API will either be methods on the EpmScript base class
or the Operation object.
EpmScript is from the package oracle.epm.api.script
Operation is from the package oracle.epm.api.model
23 Copyright © 2024, Oracle and/or its affiliates May 2024
Interface DataGrid
A data grid interface that provides access to the POV/Row/Column header cells and provides
various iterators to iterate over the data cells.
Example call from Groovy that iterates over all data cells and prints the cell member names and
data to the job console:
operation.grid.dataCellIterator().each {
println("$it.memberNames, cell data: $it.data")
}
24 Copyright © 2024, Oracle and/or its affiliates May 2024
Class Operation
This object represents an operation, in a typical EPM Groovy script, it represents the current
operation such as:
before load form
after load form
before save form
after save form
run Groovy rule, etc.
For example, operation.grid will be available in the after load form and before/after form save
operations but not in the before load form operation as the grid has not been created yet.
25 Copyright © 2024, Oracle and/or its affiliates May 2024
Frequently used Classes and Methods
Classes – Objects that expose data and actions Methods –actions that allow you to set and get
information
Application getCube
Cube dataGridBuilder
Member getDimension
Operation getGrid
DataMap execute
26 Copyright © 2024, Oracle and/or its affiliates May 2024
Types of Groovy Rules
27 Copyright © 2024, Oracle and/or its affiliates May 2024
Types of Groovy Rules
Rules that can dynamically generate calculation scripts at runtime based on contexts, such as
runtime prompts, the POV, the current grid, et cetera. The generated calculation scripts are
executed against Essbase.
For example: Calculate expenses for projects only for the duration of the project based on start
and end dates. Reuse in revenue, expense, balance sheet, and cash flow forms.
Pure Groovy rules that don't generate calculation scripts.
Perform data validations and cancel operation if the data violates your company policies for
example change the background colors of cells based on certain thresholds.
Execute the API calls using REST Api’s or EPMAutomate().
28 Copyright © 2024, Oracle and/or its affiliates May 2024
Create and Launch Groovy Rules
29 Copyright © 2024, Oracle and/or its affiliates May 2024
Create Groovy Rules
Calculation Manger Designer
Change to Edit Create Save and Launch
Script and select Deploy the
Groovy Validate the
Groovy Script Groovy
rules Groovy Groovy
mode rules
rules rules!
Groovy
30 Copyright © 2024, Oracle and/or its affiliates May 2024
Launch Groovy Rules
Execute Groovy Rules from any place where a Business Rule is executed in Planning
In Calculation Within the Context
On the Rules page
Manager of a form
Using Task lists In Data
In Dashboards Management
Using Job Using
Scheduler EPMAutomate
31 Copyright © 2024, Oracle and/or its affiliates May 2024
Demo
32 Copyright © 2024, Oracle and/or its affiliates May 2024
Review the documentation on Oracle Enterprise Performance Management Cloud, Groovy Rules
https://docs.oracle.com/en/cloud/saas/enterprise-performance-management-
common/groov/index.html
See the Examples
All Classes
No Frames
33 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy Rule - Conditional Formatting
Conditional Formatting:
34 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy Rule - Conditional Formatting Result
35 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy Rule - All Data Values
Data Form All Values
36 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy Rule - All Data Result
Application >Jobs
37 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy Rule -Data Form Modified Values
Data Form Modified Values
38 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy Rule - Data Form Modified Values Result
Application >Jobs
39 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy Rule – Tool tip
Tool tip:
40 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy Rule - Tooltip
41 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy Generated CalcScript
42 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy Generated Calc Script - Result
Application >Jobs
43 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy Rule - EpmAutomate()
EPMAutomate()
44 Copyright © 2024, Oracle and/or its affiliates May 2024
Groovy Rule - EPMAutomate() Result
Application >Jobs
45 Copyright © 2024, Oracle and/or its affiliates May 2024
Learning Resources
46 Copyright © 2024, Oracle and/or its affiliates May 2024
:
Learning Resources - Groovy
https://groovy-lang.org/
Download Java SDK
Download Apache Groovy
Use Editor (Groovy Console)
Test groovy expressions
Collections – Lists, Maps, Strings, Closures
47 Copyright © 2024, Oracle and/or its affiliates May 2024
Learning Resources – EPM Groovy
Groovy Documentation
Tutorial on Implementing Groovy Calculation Manager Videos on Using Groovy
https://bit.ly/2QpWSyD
Oracle EPM Planning – Tutorials Groovy Rules Java API Oracle EPM Planning – Videos
https://bit.ly/2QtGbSN
REST API for EPM
https://bit.ly/2Woosjr
48 Copyright © 2024, Oracle and/or its affiliates May 2024
Q&A
49 Copyright © 2024, Oracle and/or its affiliates May 2024
Thank You!
50 Copyright © 2024, Oracle and/or its affiliates May 2024