# Roundup Function

Hi,

I would like to use the roundup function to roundup the value calculated.
For example, the roundup of 83.1 will be 84.

Kindly request your guidance on how I achieve this in my app.

Thanks in advance for the guidance and support.

Warm Regards,
Jeffrey

Jeffrey,

If you are trying to round a decimal value to the next highest integer
there are a few ways to do it that come to mind. The most straightforward
would probably be

if( int(/data/value) < /data/value, int(data/value) + 1, int(/data/value))

This compares whether the decimal form of the lowest integer (83 in this
case) is smaller than the current value, and if so, rounds up, and
otherwise truncates the value.

You can put this into a hidden value that represents the integer form of
the value.

-Clayton

··· On Tue, Dec 17, 2013 at 12:28 PM, Jeffrey Jose wrote:

Hi,

I would like to use the roundup function to roundup the value calculated.
For example, the roundup of 83.1 will be 84.

Kindly request your guidance on how I achieve this in my app.

Thanks in advance for the guidance and support.

Warm Regards,
Jeffrey

You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an

Thank you Clayton. This should work for me.

Warm Regards,
Jeffrey

··· On Wed, Dec 18, 2013 at 12:51 AM, Clayton Sims wrote:

Jeffrey,

If you are trying to round a decimal value to the next highest integer
there are a few ways to do it that come to mind. The most straightforward
would probably be

if( int(/data/value) < /data/value, int(data/value) + 1, int(/data/value))

This compares whether the decimal form of the lowest integer (83 in this
case) is smaller than the current value, and if so, rounds up, and
otherwise truncates the value.

You can put this into a hidden value that represents the integer form of
the value.

-Clayton

On Tue, Dec 17, 2013 at 12:28 PM, Jeffrey Jose jeffreyjose@gmail.comwrote:

Hi,

I would like to use the roundup function to roundup the value calculated.
For example, the roundup of 83.1 will be 84.

Kindly request your guidance on how I achieve this in my app.

Thanks in advance for the guidance and support.

Warm Regards,
Jeffrey

You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an