Groovy Function


This function is used to execute a script in the Groovy programming language. Groovy is a relatively new script language that is closely based on Java syntax, but also allows a simplified syntax. It is characterized by its dynamic typing, high execution speed and good integration into the Java Virtual Machine. The Groovy function can be used to program very individual transformations implemented at runtime. It is also suitable for mathematical calculations.

More information about the Groovy programming language is available at

The input fields can be used in the script as Groovy variables:

  • If an alias is defined for the input field it defines the Groovy variable name. Valid charachters for an alias are uppercase and lowercase letters, numbers and the symbols “_” and “$”, the alias must not start with a number (e.g. “my_InputField1$” is a valid alias).
  • If no alias is defined then the name of the input field is the Groovy variable name. In that case it must be a valid Groovy identifier name, for example a “-” or “+” is not allowed.
  • Additionally also the variable name in the form “_input<i>” can be used where <i> is the position of the input field, so for example “_input1” for the 1st input field and “_input2” for the 2nd input.

A type can be assigned to each input field that defines the type of the Groovy variable in the script. If necessary, a type conversion of the input data are done before the script is executed (except for Object type, which does no conversion and keeps the input type). This is especially helpful for numerical inputs and calculations.

The following data types exist:

double short
int long
byte string
float object

The default type is string.

Script Groovy script
Type The data type of return value. All of the above data types are possible; the assignment of a type is optional.
buffered If set, the function results are cached and the script is not evaluated for identical input values (default). If not set, the script is always evaluated for all rows. This is necessary if the result depends on the row number or a random number generator.

The result of the function is determined in the script with a return statement. If no value is returned, then the function has the result NULL.

Note: for performance reasons, the Groovy function internally buffers the results, so that a script is executed only once for the same set of input values. This may lead to wrong values if the script doesn’t depend only on the input values, e.g. random value functions, use of setProperty()/getProperty(). In this case, a RowNumber function should be added to the input list of the script function so that it is always unique.

Besides the various functionalities offered by Groovy (and Java), specific Jedox Integrator functionality can be used via the Jedox Integrator Scripting API.

Input Type Alias
OrderQty double  
Unit Price double price
Possible valid scripts
return _input1*_input2;
return OrderQty*price;
double OrderValue= OrderQty*_input2;
return OrderValue;  

Was this post helpful?
NoYes (-1 rating, 5 votes)