This field type allows you to create a calculated field by calling a function.
When using some of the standard functions the calculations will be done in-memory. It means that when calculating e.g. a price total (TotalPrice = Quantity * UnitPrice
) this calculation will happen just when the user will change either a Quantity
or a UnitPrice
. The user will then get an immediate response.
When using database functions this is not possible and the data will be re-evaluated after the user saves the data.
Attributes
Function | Function to call. The function result will be the value of this field. |
ForceDatabaseCalculation | When set to True this function will always be evaluated on the database server (a SQL expression will be generated). You need to use this flag e.g. if using some database functions inside a function-call-field. Otherwise you would get a runtime error that the server cannot evaluate these functions in-memory. |
After adding the Function Call element, function parameters appear under the element depending on which function you selected. As with every function call, you must pass some values to its parameters. There are different kinds of values you can pass to the parameters:
Child Elements
Field Reference | Allows you to pass a field value of the current entity. |
---|---|
Function Call | Places a nested function call into this function call. |
Parameter Reference | Passes a parameter value into this parameter. |
Data Constant Reference | Passes a constant value. |
Filter Reference | References an existing filter as a parameter value. There are 2 possibilities where to use FilterReference:
|
Lookup Reference | You can use an existing data lookup to get data from other entities. It effectively creates an SQL subquery. |
How To Use Lookup Reference
The lookup reference is basically useful only when used inside the List parameter of the In function.
Rules:
- The lookup must have a ListMethod filled in with a filter that accepts some parameters.
- The parameters will be passed into the lookup reference by creating a ParameterMapping under the lookup reference.
- The name of the parameter mapping should be lookup + lookups paremeter name.
Example
If the target lookup has a filter by category, e.g. BusinessPartner_parCategoryId and you use it in the lookup reference, the parameter mapping’s name has to be lookupBusinessPartner_parCategoryId.
Known Issues
If you have a function field of type Currency and you use the devide function to calculate the result value make sure that both operands of the function are not of the type Integer. Otherwise you will get inconsistent values when editing the row with the function call field in lazy loaded screens. You will probably see non-zero decimal places in the result after you change the row values. The decimal places will be all zeros after you save and reload the screen.