How to round up in progress programming

Jim S. picture Jim S. · Jan 29, 2013 · Viewed 7.2k times · Source

I am writing a report for an MRP program and it contains a field I calculate for the quantity to order. I need to round the number up if it is a decimal point.

For example: 2.33 needs to be rounded up to 3 and so on.

I have tried

oder = round(order,0).

but that just get me 2.00 I need that number to be rounded up to the next whole number.

Answer

Tom Bascom picture Tom Bascom · Jan 29, 2013
function roundUp returns integer ( x as decimal ):

  if x = truncate( x, 0 ) then
    return integer( x ).
   else
    return integer( truncate( x, 0 ) + 1 ).

end.

display roundUp( 2.33 ).