This
time, A different scenario was accomplished using the Groovy by one of my
teammates. I thought of sharing here.
The requirement is to populate the Long-range planning and the rule will perform an action if the OEP_Plan (budget) is selected in the RTP and a different action if OEP_Actual (actual) is selected in the RTP.
In this scenario, we utilized Groovy known for its flexibility and simplicity, was employed to implement the necessary logic and actions based on these selections. Groovy's dynamic nature and concise syntax likely made it well-suited for handling such conditional tasks effectively.
The Rule
/* RTPS: {Scenario} {Version} {Years}
*/
String
calcScript = ""
//Capture and print the Scenario entered.
println("RTP value: $scenarioVariable")
if (scenarioVariable == '"OEP_Plan"') {
calcScript = """
FIX ("No FlexDimension")
FIX(
@Relative("Input
Currencies", 0),
@Relative("OEP_Total
Entity", 0),
@Relative("Total Product", 0),
@Relative("Total
Customer", 0),
@Relative("Total
Market", 0),
@Relative("Total
CostCenter", 0)
)
FIX(
"Salable Units",
"Avg Selling Price for Salable
Units",
"Avg Cost for Salable
Units",
@Relative("Management_hierarchy", 0)
)
FIX(@Relative("YearTotal", 0))
// Some calculations here.
ENDFIX
FIX("OEP_LRP",
&LRP_Version, &LRPPreviousYr)
"Dec"
(
// Some additional
calculations here.
)
ENDFIX
ENDFIX
ENDFIX
ENDFIX
"""
} else if (scenarioVariable == "OEP_Actual") {
calcScript = """
FIX ("No FlexDimension")
FIX(
@Relative("Input
Currencies", 0),
@Relative("OEP_Total
Entity", 0),
@Relative("Total
Product", 0),
@Relative("Total
Customer", 0),
@Relative("Total
Market", 0),
@Relative("Total
CostCenter", 0)
)
FIX(
"Salable Units",
"Avg Selling Price for
Salable Units",
"Avg Cost for Salable
Units",
@Relative("Management_hierarchy", 0)
)
FIX(@Relative("YearTotal", 0))
// Some different calculations here.
ENDFIX
FIX("OEP_LRP",
&LRP_Version, &LRPPreviousYr)
"Dec"
(
// Some different
additional calculations here.
)
ENDFIX
ENDFIX
ENDFIX
ENDFIX
"""
}
//If there is issue with creating the script
println("No input was found!")
return
}
//Print the person who ran the script is captured in the jobs logs.
//Print the script that was created during the runtime.
println(calcScript)
Tada this is done. A big thanks to my teammate for this idea.
Happy days on the Cloud!!!
No comments:
Post a Comment