Hi,
Important! Changing the numberFormat does not automatically change the format of a number that's already in a container. It affects numbers only when they are calculated and then displayed or used as strings. Otherwise, the number retains its full numeric precision.
Well, "numberFormat" is tricky - better leave it alone.
Hint:
Code: Select all
put "£ "& dbData*1 into fld "totalFunds"
should do the trick ...
Much more easy is:
Code: Select all
format("%." & MyPrecision & "f", MyNumber)
(put "£ "& format("%.2f",dbData) into fld "totalFunds")
Works like "numberformat" should, but has C like rounding (AFAIK).
or simply:
(put "£ "& round(dbData,2) into fld "totalFunds")
Has nice financial rounding, but omits trailing zeroes.
If you want the financial rounding of "round" plus the guaranteed suiting zeroes of "format", use:
Code: Select all
function kround theNum, Prec -- nice fin. rounding with exactly Prec items trailing
if Prec is empty then put 2 into Prec
return format("%." & Prec & "f",round(theNum, Prec))
end kround
(put "£ "& kround(dbData) into fld "totalFunds")
Have fun!