Announcement

Collapse
No announcement yet.

Rounding a decimal field on a single form

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rounding a decimal field on a single form

    Having a problem getting a decimal field on a single form to round up to the nearest whole number.

    Using OnLoad code below works great to calculate my field.
    {Avg_FPM} = ({FV_1}+{FV_2}+{FV_3}+{FV_4}+{FV_5}+{FV_6}+{FV_7}+ {FV_8})/8;

    Field Avg_FPM is set to Decimal in Scriptcase
    Decimal Precision is set to 0.

    In testing, when I input numbers that average out to be .5 or higher the system isn't rounding up to the next whole number. For example if my calculation total comes up to be 10.6, the field should display 11 but it is currently displaying 10 instead.

    Any suggestions would be greatly appreciated!
    Thanks!

  • #2
    You need to use the round function to have the sum correctly rounded. See php documentation for samples:

    http://php.net/manual/en/function.round.php
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment

    Working...
    X