Hi Tom,
There's problems with your implementation. Consider the follow inputs into
your function: 23.04 and 18.996.
===
For 23.04,
dollars = Int(23.04) = 23
cents = Round(23.04 - 23 ; 2) = Round(0.04;2) = 0.04
CentsAsText = Left(100 * 0.04 & "00";2) = Left(4 & "00";2) = Left("400";2) =
"40", which is incorrect.
===
The above result happens for amounts with cent values between 0.01 and 0.09.
===
You can carefully work through "18.996" to see the problems there. However,
"18.996" may be ouotside the domain of Sue's input.
Regards,
Jason L. DeLooze
Annapolis, MD USA
At 7:11 PM +0100 4/2/07, Tom Elliott wrote:
> Sue
>
> if the result is for display purposes only) you might be able to use merge
> fields on your layout since you can then specify the Number format. But if
> this is not possible for some reason then this formula gives currentpayfield
> formatted as a dollar amount with 2 cents digits:
>
> "$"& Int (currentpayfield) & "." & Left (100 * Round(currentpayfield- Int
> (currentpayfield) ; 2) & "00" ; 2)
>
> if you're using FMP 7 or later you could use:
>
> Let ([ dollars = Int (currentpayfield) ;
> cents = Round (currentpayfield - dollars ; 2) ;
> centsAsText = Left (100 * cents & "00" ; 2)
> ] ;
> "$" & dollars & "." & centsAsText
> )
>
> to make it more readable
>
> cheers
>
> Tom