formatting data in a field

Peter Haworth pete at mollysrevenge.com
Sat Apr 3 13:10:05 EDT 2010


Since you are already calculating the number, you could use the round  
function in your calculation:

round(a *b,2)  would give you 3.17 and round (a*b,-2) would give you  
3.16 (I think, I haven't tried negative rounding)

Pete








On Apr 3, 2010, at 10:00 AM, use-revolution-request at lists.runrev.com  
wrote:

> David,
>
> put 3.1666 into mySum //result of your calculation
> set the numberFormat to "0.00" // you can do this earlier in the  
> script
> put mySum*1 into fld "Sigh" // calculate to make numberFormat work
>
> --
> Best regards,
>
> Mark Schonewille
>
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
>
> Economy-x-Talk is always looking for new software development
> projects. Feel free to contact me for a quote.
>
> Op 3 apr 2010, om 13:27 heeft David Coker het volgende geschreven:
>
>> Hello folks,
>> I seem to continually get hung up in areas that should be fairly
>> simple by now.
>> Here is the latest that I find myself banging my head over...
>>
>> <sigh>
>> Lets say that I have two fields calculated where the sum contains
>> something like 3.1666 as an example.
>> What would be the proper way to format the display field as 3.16 ?
>> </sigh>
>>
>> I've tried using both "format" and "numberFormat" in various ways
>> without any luck so far
>> As always, I certainly appreciate any and all help I get.
>>
>> David C.
>




More information about the use-livecode mailing list