Coerce number into numberFormatted integer--How?

J. Landman Gay jacque at hyperactivesw.com
Wed Jul 10 11:52:01 EDT 2002


On 7/10/02 1:58 AM, Sivakatirswami <katir at hindu.org> wrote:
> 
> But how to coerce the simple integer that
> is not a result of math into the dollar format... I *can* just "fake" a
> calculation put (1*tShipping) into tShipping. And that works, but, hoping
> not to have to be doing that in the long term,


Numberformat only operates on the result of a calculation, and some type 
of math is required before numberformat will kick in. That's how 
HyperCard works too.

Sometimes it is necessary to force a fake calculation, for example when 
formatting numbers typed into a field ("add 0 to me" in a closefield 
handler), but most of the time there is usually some kind of calculation 
going on in the script anyway; the secret is just to place the 
numberformat command before any of the calculations happen. Sometimes 
just placing the numberformat instruction at the top of the handler is 
all it takes.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the Use-livecode mailing list