Skip to content

groovy/rtp-declared

Starts at Warning. It reads Groovy files in Rules, Templates, and Scripts. It works before your first Pull, and once a Pull brings down the Rule’s prompt definitions, it uses those too.

Every Run-Time Prompt your Groovy reads through rtps must be declared. A read looks like rtps.RTP_ENTITY, for example rtps.RTP_ENTITY.toString().

A prompt counts as declared when it is named in the RTPS header comment at the top of the Rule, such as /* RTPS: {RTP_ENTITY}, {RTP_YEAR} */, or in the prompt definitions the Pod Folder holds for that Rule, such as the ones that came down with it on a Pull.

  • Case doesn’t matter, the same as in Oracle. {RTP_Fund} in the header covers rtps.rtp_fund.
  • A read inside a comment doesn’t count.
  • A read inside a string does count, so "Version: ${rtps.RTP_VERSION}" is a real read.
  • rtps.get("NAME") and rtps.each { … } are skipped, because the prompt name isn’t written in the code.
  • Each read is underlined separately. Declaring the name once clears them all.

See Run-Time Prompts for how prompts are declared and edited.

Oracle builds the prompt dialog from what the Rule declares. A prompt that isn’t declared is never shown to the user, so at run time rtps.RTP_VERSION arrives empty. The Rule may still run, with nothing where the value should be. Usually that means the calculation quietly targets the wrong slice, or the Rule fails with an error deep inside a generated script. Nothing in the Rule looks wrong, which makes this one slow to find after the fact.

An allocation Rule in ACMEPLAN declares two prompts and reads three:

/* RTPS: {RTP_ENTITY}, {RTP_YEAR} */
String entity = rtps.RTP_ENTITY.toString()
String year = rtps.RTP_YEAR.toString()
String version = rtps.RTP_VERSION.toString()

RTP_VERSION is underlined, and the message reads:

Run-Time Prompt "RTP_VERSION" is read via rtps.RTP_VERSION but not declared in the RTPS header.

Corrected, with the prompt added to the header:

/* RTPS: {RTP_ENTITY}, {RTP_YEAR}, {RTP_VERSION} */
String entity = rtps.RTP_ENTITY.toString()
String year = rtps.RTP_YEAR.toString()
String version = rtps.RTP_VERSION.toString()

If the read was the mistake (a typo, or something left over from an older version of the Rule), delete the read instead. The Lint Rule can’t tell those two cases apart, which is why it starts at Warning rather than Error.

Click the underlined prompt name and press Ctrl+. (Cmd+. on a Mac), then choose Declare {RTP_VERSION} in the RTPS header (the menu shows the name you clicked). It adds the name to the end of the header, using the same separator the header already has. If the Rule has no header yet, it adds /* RTPS: {RTP_VERSION} */ as the first line.

Change its level (Error, Warning, Info) or turn it off in the Lint Rules panel, or excuse one file with a Lint Exception.