{{sidenavigation.sidenavigationExpandLabel}}
{{getMsg('Help_YouAreHere')}}: {{page.title}} {{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}} {{helpModel.downloadHelpPdfDataStatus}}

User Defined Functions

A user defined function is a function written in one of the formula languages of i-net Clear Reports. Unlike the user defined functions written in Java, a user defined function based on a formula is saved within the current report and can therefore be used anywhere without further configuration.
User defined functions release you from writing hidden formula fields and passing global variables just to perform additional and common calculations. They can be used just like any built in function of i-net Clear Reports! The only limitation of user defined functions compared to formula fields is that the result of a user defined function must only depend on its parameters, meaning that field references and several functions cannot be used.

How to create a user defined function

User Defined Functions A user defined function is created in the formula editor. To create a new user function, simply open the formula editor, select the user defined functions node and click on the new button. Now you'll have to enter a name, which is restricted to alpha-numeric characters and may not start with a number. At last you have to define the parameter types and names of this function. This has to be done within the formula text. For an exact definition, please have a look at the Basic function syntax or the Crystal function syntax.
Apart from the header definition, a user function can be written like a normal formula.

How to call a user function

Calling a user function is done the same as calling any other built in function of i-net Clear Reports. Since the parameters of a user function can be defined as optional, you can skip optional parameters from right to left. In that case the pre-defined default values will be used for these parameters.

Restrictions of a user function

User functions are not bound to an evaluation time like a formula field. To achieve this goal, a user function cannot use

  • variables from a scope other than local, which makes local the default scope as well
  • references to any field of the report
  • built in functions with an evaluation time of 'while reading' or 'while printing'
  • user defined Java functions
  • recursion into itself, they can only call other user functions

Furthermore a user function must have a distinct name. You cannot define different parameters / signatures for a function name like in most programming language. You can, however, define certain parameters as optional.

Optional parameters

When defining the parameter signature of a user function, parameters can be marked as optional. In that case, a default value has to be defined for this parameter and any following parameter is forced to be optional as well.
If some of these optional parameters are left out when calling the function, their value will be set to the default. Parameters can only be skipped from right to left to avoid ambiguous default value assignments.

i-net Clear Reports
This application uses cookies to allow login. By continuing to use this application, you agree to the use of cookies.


Help - User Defined Functions