NF8.2 Print Format Item Script
Feature: Print Format Item Script
Now you can do numeric calculations over the columns of a print format, and even execute SQL to obtain values to print.
The new Format Type = Script let you define the calculation in the new field Script:
You can use the variable @COL/column_name@ to indicate a column in the calculation, for example @COL/T_Integer@ means the column with name T_Integer in the report:
The script is calculated using beanshell, you can use normal numeric operators supported by beanshell.
Running Total (Accumulate)
In a similar way, for example if you want to print a running total for the column T_Amount, you can use the variable @ACCUMULATE/T_Amount@ in the calculation:
Note you can combine accumulate and column in the same formula.
And also you can use @SQL= to define an arbitrary SQL to print a column:
Note about Security
Please note that the beanshell is too powerful but also too dangerous, the field could be misused for SQL Injection, exposing database sensitive information, or even running scripts in the operating system.
That's why the script field is protected, just to be configured by advanced roles.