Hi,
we are calculating the average of three user inputs (decimal) and
store the result in a "readonly" variable.
The calculation gives us far too many digits after the decimal point.
How can we control the number of digits after the decimal point?
Thank you!
There is an int(.) function which converts numbers to integers. So if you
want to truncate at the 0.01's, you should be able to do
number( int(. * 100) ) / 100.0
Mitch
···
On Thu, Apr 26, 2012 at 1:59 AM, LETSGO CeLeKT wrote:
Hi,
we are calculating the average of three user inputs (decimal) and
store the result in a "readonly" variable.
The calculation gives us far too many digits after the decimal point.
How can we control the number of digits after the decimal point?
Thank you!
--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en
--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com
That solved the problem! Thank you.
···
On 26 Apr., 17:37, Mitch S wrote:
> There is an int(.) function which converts numbers to integers. So if you
> want to truncate at the 0.01's, you should be able to do
>
> number( int(. * 100) ) / 100.0
>
> Mitch
>
> On Thu, Apr 26, 2012 at 1:59 AM, LETSGO CeLeKT wrote:
>
> > Hi,
>
> > we are calculating the average of three user inputs (decimal) and
> > store the result in a "readonly" variable.
> > The calculation gives us far too many digits after the decimal point.
> > How can we control the number of digits after the decimal point?
>
> > Thank you!
>
> > --
> > Post: opendatakit@googlegroups.com
> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com
> > Options:http://groups.google.com/group/opendatakit?hl=en
>
> --
> Mitch Sundt
> Software Engineer
> University of Washington
> mitchellsu...@gmail.com
There is an int(.) function which converts numbers to integers. So if you want to truncate at the 0.01's, you should be able to do
number( int(. * 100) ) / 100.0
Mitch
Hi,
we are calculating the average of three user inputs (decimal) and
store the result in a "readonly" variable.
The calculation gives us far too many digits after the decimal point.
How can we control the number of digits after the decimal point?
Thank you!
--
Post: opend...@googlegroups.com
Unsubscribe: opendatakit...@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en
--
Mitch Sundt
Software Engineer
University of Washington
mitche...@gmail.com
Hi Mitch,
Just came across this number( int(. * 100) ) / 100.0 but I'm unable to use it.
Am having the calculation (today() - ${dob}) div 365.25 for the age.
How can I make sure the answer is in 2 decimal places?
Many Thanks,
John
···
On Thursday, April 26, 2012 6:37:56 PM UTC+3, Mitch Sundt wrote:
> On Thu, Apr 26, 2012 at 1:59 AM, LETSGO CeLeKT wrote:
The "." refers to the current field's value. If you are writing a
constraint for a field, you can write, for example,
. < 10
To constrain the answer for this field to be less than 10.
So in the original post, if you replace the "." with your calculation, it
should work.
···
On Mon, Dec 1, 2014 at 4:07 AM, wrote:
On Thursday, April 26, 2012 6:37:56 PM UTC+3, Mitch Sundt wrote:
There is an int(.) function which converts numbers to integers. So if
you want to truncate at the 0.01's, you should be able to do
number( int(. * 100) ) / 100.0
Mitch
On Thu, Apr 26, 2012 at 1:59 AM, LETSGO CeLeKT letsgo...@gmail.com wrote:
Hi,
we are calculating the average of three user inputs (decimal) and
store the result in a "readonly" variable.
The calculation gives us far too many digits after the decimal point.
How can we control the number of digits after the decimal point?
Thank you!
--
Post: opend...@googlegroups.com
Unsubscribe: opendatakit...@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en
--
Mitch Sundt
Software Engineer
University of Washington
mitche...@gmail.com
Hi Mitch,
Just came across this number( int(. * 100) ) / 100.0 but I'm unable to
use it.
Am having the calculation (today() - ${dob}) div 365.25 for the age.
How can I make sure the answer is in 2 decimal places?
Many Thanks,
John
--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en
You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com