Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Written by:

(info) Input Generation mode was previously call Syntax Check mode. 

Our formulas are used to calculate the results but at the same time also serve as configuration mechanism to drive certain UI elements, such as necessary input parameters.

...

Input Generation Mode

To avoid the need to declare input parameters explicitly (they show up as you start using/expecting them in the formula), a mechanism called “syntax check mode” input generation modeis used (sometimes also called "dry run").

As the name implies, it not only determines inputs but also checks the formula for syntactical validity. This is e.g. the reason why a formula is executed in that mode once before saving it to prevent invalid formulas to be saved.

During such a syntax check executionan input generation, it is good to know:

  • As formula inputs may actually be no real inputs as their data e.g. comes from previous calculation steps, the formula returns a default value for every input it encounters during this syntax check input generation mode.
  • This way the formula engine can in the end distinguish between “real” inputs (that it then needs to render to the user) and inputs that are fed by other formula elements (and do not trigger a UI element to be shown).

As you can see, determining inputs and executing formula are two calculation passes of the same “thing”. To not have negative performance impact, the syntax check passes the input generation passes are only done when required.

...

Code Block
def inputVal = api.userEntry()
if (api.isSyntaxCheck())  return;
def costs = api.find("PX", equal("name", "costs"))

Note: 

  • api.getElement() will return always a BigDecimal number, regardless of its value returned during regular execution of the logic.

  • Also some other functions will return "null" instead of proper values.

  • api.stream and DatamartContext.streamQuery() are not supported in

...

  • input generation, but api.find is.