If you're building Groovy business rules in Oracle Cloud EPM, you've likely encountered EpmScript
. It's not a class you import or instantiate—it's just there, quietly offering its powerful methods to control almost every part of your Planning application.
In this blog, we’ll demystify EpmScript
, explore its capabilities, and walk through practical examples of how it unlocks dynamic planning automation.
What is EpmScript
?
EpmScript
is the base class for all Groovy rules in Oracle EPM Planning. Its methods are globally available, meaning you can call them directly without creating an instance.
Think of it as the operating system of your Groovy script: it lets you access the application, runtime prompts, metadata, and more.
What Can You Do with EpmScript
?
Here are some of the key things EpmScript
enables:
Task | Method |
---|---|
Access runtime prompts | getRtp(name) or getRtps() |
Access the current application | getApplication() |
Get members of a dimension | getMembers(dimensionName) |
Create or modify metadata | createOrUpdateMembers(dimensionName, members) |
Access all cubes | application.getCubes() |
Get dimensions in cubes | Application.getDimensions(cube) |
Let’s explore each of these through examples.
Accessing Runtime Prompts
If your script uses Runtime Prompt Variables (RTPs), EpmScript.getRtps()
is your gateway.
Here, rtps
is the result of EpmScript.getRtps()
—and you always need the /* RTPS: */
comment to declare them.
Getting the Current Application and Its Cubes
Application app = application // shortcut for EpmScript.getApplication()
List<Cube> cubes = app.getCubes()
Querying Dimension Members
Want to list all accounts? Easy:
List<Member> accounts = getMembers("Account")
accounts.each { println it.name }
Creating or Updating Members
Need to add new members to a dimension? Here's how to do it with EpmScript.createOrUpdateMembers()
:
/* RTPS: */
DimensionBuilder builder = application.getDimensionBuilder("Account")
builder.addMember("NewRevenue", "Revenue") // add NewRevenue under Revenue
builder.build() // apply changes
In this example:
-
We get the dimension builder for "Account".
-
We define a new member under "Revenue".
-
We commit the changes with
build()
.
No comments:
Post a Comment