Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AW database field and floating point




Le 26 oct. 2005 , à 22:08, Jan E. Schotsman a écrit :


On 26-okt-05, at 19:25, Yvan KOENIG wrote:


Hello,

how can I set floating point values in a number field of an AppleWorks
database with a given precision?
For example, 10.8 now ends up as 10.800000191. I want it to stay 10.8.


TIA,

Always use the ROUND() function

How can I do this in a script please?

"set myVar to floatValue"   becomes??


One trick is to put the value in a complementary field named 'rawValue' for instance
and use a calculated field name 'formattedValue' for instance
whose formula is
Round('rawValue',1)
Without such a formula, you are hitting the limits of the precision available.



You may perhaps (but I didn't check) coerce your value as a string (take care of the decimal separator wich is not the same worldwide) and pass the string to the field.
If I remember well, using this trick will pass the correct decimal digits as it doesn't use the AS's internal representation of numbers.


Yvan KOENIG

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden
References: 
 >Re: AW database field and floating point (From: "Jan E. Schotsman" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.