These new functions add some nuanced capability when dealing with fractions in flow forms.
Summary
These improvements expand on the capability of the flow calculations field introduced in OFS Version 11 update 2. Several new functions have been added to calculations, allowing users to perform rounding on fractions, as well as limiting results to fixed decimal places.
Feature Overview
- Four new functions have been introduced (round, roundup, rounddown and fixed)
- These can be used in calculation field formulas when building flow forms.
Currently these functions are not documented when building forms, however the syntax function syntax is available (Details below).
Utilising functions in Calculation Field formulas
The new functions are easy to use in flow calculations. For the rounding functions, simply specify the function and wrap the value to be rounded in parentheses. Eg:
round(2.1)
As illustrated below, the wrapped value can be a reference to another field within the form:
The same is true for the fixed function, except that it requires a 2nd argument specifying the maximum number of decimal places to use: