How do you get a field to display its contents in currency format (i.e. with $ sign and commas)?
Thank you for your help.
Peter
Currency display in a field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 179
- Joined: Sat Apr 08, 2006 11:08 pm
- Contact:
Peter, there isn't a built in property of fields to do this.
You have the choice of a handler in the field script, or a function in your stack or a library.
The first might be, in the field's script:
so then, instead of you could
Or, (and I prefer this idea) have a function like the one above that you call when putting a number into the field:
Hope this helps,
Mark
You have the choice of a handler in the field script, or a function in your stack or a library.
The first might be, in the field's script:
Code: Select all
on setCurrencyText pAmount
put "$" & format("%1.2f", pAmount) into me
end setCurrencyText
Code: Select all
put 20.4 into fld "someField"
Code: Select all
send "setCurrencyText 20.4" to fld "someField"
Or, (and I prefer this idea) have a function like the one above that you call when putting a number into the field:
Code: Select all
put makeCurrency(20.4) into fld "someField"
Hope this helps,
Mark