Oracle EPM- Updating Substitution Variable using Groovy
Hi Folks, I hope you must be enjoying my post. This post is dedicated towards one of special request from customer/admin where they wanted to update a substitution variable of the Oracle epm planning without going to the variable section of the application. Purpose was to update the value from a data form and avoid updating other variables mistakenly.
So we created a groovy rule and called it on a data form using right click menu option. The detail of the rule is as below:-
/*RTPS: {zslYear}*/-------------------->RTP variable Name created in variable designer
String cubeName = "All Cubes"
String varName = "TestYear1" -------------------->Variable Name
String varValue = rtps.zslYear.enteredValue-------------------->RTP variable Name created in variable designer
String oldValue = ""
if (cubeName == "All Cubes") cubeName = "ALLCUBES"
Cube cube
if (cubeName == "ALLCUBES") {
if (operation.application.hasSubstitutionVariable(varName)) {
oldValue = operation.application.getSubstitutionVariableValue(varName)
operation.application.setSubstitutionVariableValue(varName, varValue)
println("The Substitution Variable ${varName} in the Application ${operation.application.name} has been changed from ${oldValue} to ${varValue}")
} else {
throwVetoException("The Application ${operation.application.name} does not have a Substitution Variable called ${varName}")
}
} else {
cube = operation.application.getCube(cubeName)
if (cube.hasSubstitutionVariable(varName)) {
oldValue = cube.getSubstitutionVariableValue(varName)
cube.setSubstitutionVariableValue(varName, varValue)
println("The Substitution Variable ${varName} in the Cube ${cube.name} has been changed from ${oldValue} to ${varValue}")
} else {
throwVetoException("The Cube ${cube.name} does not have a Substitution Variable called ${varName}")
}
}
Do create a RTP member and update this rule with your variable name. This solved the client purpose and at the end we both were happy.
!!Happy Reading!!
Comments
Post a Comment