curious behavior...

jcwall at jaguar1.usouthal.edu jcwall at jaguar1.usouthal.edu
Sat May 29 03:21:27 EDT 2004


Slightly off topic but to do with numberFormat.

I have had some difficulties with this property which I have managed to get around.  I needed to do some calculations and enter the result in a field limiting the number to two decimal places.  Set the numberFormat to "0.00" works as documented.  My difficulty came when I needed to do calculations within a repeat loop e.g.

set the numberFormat to "0.00"
put 1 into i
repeat 3
put "ETGUG" & i into x
add fld x to fld "Answer"
add 1 to i
end repeat

Because of the numberFormat instead of x being ETGUG1 as I had hoped because that is the name of the field thet I wanted, it becomes ETGUG1.00 and since there is no field ETGUG1.00 the script fails.  As I said, I have managed to solve the problem by constantly changing the numberFormat property so this is not a pressing issue.  However, it was messy and I thought that if it were possible to set the number format of the field this would simplify the process.  I tried set the numberForma
t of fld "ETGUG1" but, as documented, this does not work.  Does anyone know if there is some way to accomplish this?

Jim Wall

----- Original Message -----
From: Chipp Walters <chipp at chipp.com>
Date: Friday, May 28, 2004 3:19 pm
Subject: curious behavior...

> I'm trying to programatically set the numberFormat property.
> 
> on mouseUp
>   repeat 4 times
>     put "#" after t
>   end repeat
>   put "set the numberFormat to " &quote& t &quote into tDo
>   do tDo
>   put 5+1
> end mouseUp
> 
> puts just "6" in the msg
> 
> now if I try:
> 
> on mouseUp
>   set the numberFormat to "####"
>   put 5+1
> end mouseUp
> 
> It puts the expected "0006"
> 
> Any ideas why??
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 



More information about the use-livecode mailing list