Skip to content

groovy/macro-resolves

Severity error by default. It runs on Groovy bodies (.groovy) in a Pod Folder, including the calc script text a Groovy Rule builds inside a string and hands to executeCalcScript.

Two things about every %Template, %Script, and %Rule macro:

  1. The name must belong to an artifact that exists in this Pod, of that kind. %Script(name:="Clear_Working") resolves only against Scripts, so a Template with the same name does not satisfy it.
  2. The macro must be spelled the way Deploy’s expander recognizes it, which is %Template( or %Script( with that exact capitalization and no space before the parenthesis.

Details worth knowing:

  • Artifact names are matched without regard to capitalization, the way Oracle stores them, and names with spaces and dashes are fine.
  • Macros in line and block comments are ignored.
  • A macro nested inside another macro’s dtps:=(...) argument is checked too.
  • A macro with no name:= argument is left alone. That is a syntax problem with no name to point at.
  • %Rule is name-checked but not spelling-checked, because Deploy has no %Rule expander to satisfy.

It needs to know what the Pod contains, so until the Pod Folder actually holds artifacts it reports nothing rather than guessing that every macro is broken. Run Pull or Import a Snapshot first.

Deploy expands these macros before it sends anything to Oracle. A name that resolves to nothing stops the Deploy, and a misspelled macro word is worse: the expander never sees it, so the text ships to Oracle exactly as written and the Rule fails when someone Executes it, with “Invalid Calc Script syntax” and a line number that points at generated text. This Validation Rule moves both failures to the moment you type them.

A Groovy Rule in acmeplan builds a calc script that clears and re-aggregates:

String script = """
FIX("FY26", "Working", @RELATIVE("Total Entity", 0))
%Script(name:="Clear_Workng")
%template(name:="Agg_Entity",plantype:="FINANCE",dtps:=())
ENDFIX
"""
operation.application.getPlanType("FINANCE").executeCalcScript(script)

Two problems, two messages. The Script name is a typo:

%Script(name:="Clear_Workng") does not resolve — this Pod has no Script named "Clear_Workng".

The Template name is correct, but the macro word is lower case, so Deploy would ship it verbatim:

Deploy will not expand this macro — it must be spelled exactly `%Template(` (this capitalization, no space before the parenthesis). As written it is deployed verbatim and the rule fails at run time with "Invalid Calc Script syntax".

Corrected, with the Script name spelled the way the Pod has it and the Template macro capitalized the way Deploy reads it:

%Script(name:="Clear_Working")
%Template(name:="Agg_Entity",plantype:="FINANCE",dtps:=())

Change its severity or turn it off in the Validation Rules panel, or exempt one artifact with an Exception.