Groovy - Using RTP's in Groovy in (E)PBCS

Hi All,

Continuing the Groovy series, today we will see how to use RTP's in Groovy in EPBCS.

Lets follow the Groovy Example given here.

Details of RTP properties are as below



Based on the above definition I have created the below sample script, lets see what values it prints in the log









When I ran it through Planning Rules or Calc Manager it gave me below errors (A method called by the script failed on line: 1, with error: No Rtp with the name <vYear> found.)

Error


Upon reading the documentation again I found that the RTP's should be declared in the first line




So the updated script is











Now observe, it started showing vYear variable in the variable section below. After the execution the result is as below
















So entered value returns the value user enters (&CurrentYear) was the prompt value passed to the RTP and the normal rtps call returns the actual value.

Another example. In this example we are using .member property of rtps which converts the rtp to member class and now we can start using the properties of member (details can be found in the link shared above) here we are using hasUda property of member class











Lets run the rule with the entity which has UDA "PCC: EUR" and which doesn't have

















Now you can generate the script based on the UDA of the selected member.

Another example of RTP is fetching the LSIBLING of the selected Year.

Script is as below







Output of the script is















You can also have the default value (ex. Descendants("All Product")) in the variable and hide it in the script, it will fetch the all the descendants in the variable using rtps.variablename.


Hope you find some value in this post :)


Comments

  1. how would i make my RTP call the level 0 of the chosen RTP?

    ReplyDelete
    Replies
    1. Hi,
      If you want to pass the level 0 you can use
      String Entity = 'Ilvl0Descendants(' + rtps.vEntity + ' )'

      Delete
  2. Where do you find Groovy documentation?

    ReplyDelete
    Replies
    1. Here is the link -- https://docs.oracle.com/en/cloud/saas/enterprise-performance-management-common/groov/index.html

      Delete
  3. Thanks so much, this was very helpful!

    ReplyDelete

Post a Comment