Hello @jayceezay
Please use the PREC operation.
PREC(X, Y) rounds the number X with Y decimals. The PREC operation supports a third parameter with the value true or false (false is the default value). If the third para parameter is true and X is an integer number, the PREC operation returns the integer number without decimals. For example, if you have the operation fieldname1+fieldname2, and you want the result with four decimal places, you can edit it as follows:
PREC(fieldname1+fieldname2, 4, true)
Best regards.
В якому місці цю формулу потрібно ставити для заокруглення?
Ось я вставий цю функцію до формули. PREC((fieldname9)(fieldname7/100)(0,789/1000)/(fieldname2*fieldname6))
Як мені змінити цю формулу, щоб показувало в кінцевомо розрахунку один знак після коми?
Hello @doradvokat
Thank you very much for using our plugin.
The equations are entered through the “Set equation” attribute in the calculated fields, and the PREC operation must be the outermost operation in the equation.
If you have a simple equation like fieldname1*fieldname2 and want the result with four decimals, the proces is straightforward:
PREC(fieldname1*fieldname2, 4, true)
However, in complex equations the process could not be evident.
For example, in te equation:
(function(){
if(fieldname1 < fieldname2) return fieldname1 * fieldname2;
else return fieldname1/fieldname2;
})()
In this case, there are two last operations in the equation, the return instructions. So, you must call the PREC operation in both.
(function(){
if(fieldname1 < fieldname2) return PREC(fieldname1 * fieldname2, 4, true);
else return PREC(fieldname1/fieldname2, 4, true);
})()
Best regards.
Hello @doradvokat
The PREC operation accept thre parameters, the value to round, the number of decimals, and true or false. If the third parameter is true, and the valis an integer, the operation does not include decimals to the result.
So, if want rhe result with only one decimal place, the equation would be:
PREC(fieldname9*(fieldname7/100)(0.789/1000)/(fieldname2*fieldname6),1,true)
Note I included other important modifications in your code like the “*” operator and the correct decimal symbol “.”.
Please note the plugin support does not cover implementing the users’ projects. If you need the specific implementation of the equations, you should contact us directly through the plugin website:
https://cff.dwbooster.com/customization
Best regards.