• Resolved Big_Rich

    (@big_rich)


    Hi,

    I’ve created a form with a checkboxes field containing 98 choices.

    If you select all 98 of the choices then they are added up correctly.

    It’s a cost calculator so all the values have 2 decimal places.

    I’ve noticed that if you select the choices one at a time and check the result then, sometimes the total displayed is wrong.

    For some reason, the total is sometimes displayed incorrectly with 13 decimal places.

    Do you know what might cause this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @big_rich,

    For rounding the result with two decimal places, use the PREC operation as the outermost operation in the equation:

    PREC(X,Y) rounds the number X with Y decimal places.

    So, if your equation is for example: fieldname1+fieldname2 you should edit it as follows: PREC(fieldname1+fieldname2, 2)

    The issue with the mathematical operations in javascript when the operands are decimals, is extensively documented, but the PREC operation allow you correct it.

    Best regards.

    Thread Starter Big_Rich

    (@big_rich)

    Thanks a lot @codepeople, that works perfectly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘sometimes the calculated field has 13 decimal places instead of 2’ is closed to new replies.