Groovy - Issue calling calc script template inside a groovy script
Summary:
I have a groovy rule that executes a calc that references a Template. I am passing the template name using a variable.
I am getting a generic error. If I print the calcScript, that is giving the correct result, but the rule is unable to compile it.
Any help on this will be of great help.
/*Code Snippet*/
Cube cube = operation.application.getCube("WFPln")
String TempName = "Test_Script"
StringBuilder calcScript = StringBuilder.newInstance()
calcScript << """
FIX("BU_None")
%Template(name:="${TempName}",application:="JLLFPA",plantype:="WFPln",dtps:=())
ENDFIX
"""
println calcScript
cube.executeCalcScript(calcScript.toString())
Error:
A method called by the script failed on line: 17, with error: Invalid Calc Script syntax [