Formatting Numbers
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Formatting Numbers
Got several fields in my database that are currency values. Linking a field on a form to any of them results in just the raw number being displayed, for example 10.0. What I need is for the number to be displayed as $10.00. Some of them will need comma(s) inserted as thousands separators and the formatting also needs to deal with negative values.
Do I have to write my own code to take care of all that or are there built-in functions to take care of it?
Do I have to write my own code to take care of all that or are there built-in functions to take care of it?
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
I'm afraid you'll have to "roll your own" - though you can search the use-revolution list archives to find some past attempts and adapt those to your needs. Here's one of my versions of a numeric field with separators http://article.gmane.org/gmane.comp.ide ... .user/8374, cobbled together from several earlier posts.
Jan Schenkel.
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
-
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
- Contact:
Don't give up now, you'll see once you get used to Rev, you'll notice that you won't need to spend hours writing code for really basic things anymore... Everybody has to start at the bottom right?phaworth wrote:I'm beginning to think Revolution is not for me. I'm impressed with a lot of its functionality but I don't really want to spend hours writing code for really basic things like formatting numbers and being able to pick a date from a calendar grid.

-
- Posts: 47
- Joined: Sat Nov 17, 2007 6:04 pm
-
- Posts: 47
- Joined: Sat Nov 17, 2007 6:04 pm
Easy peasy.
Open up the script and delete this line:
Of course, if you want to put a comma in there, you'll now have to enter it as one of the parameters of the function.
Cheers,
Steve
www.theworcestersource.com
Open up the script and delete this line:
Code: Select all
if pSeparator="" then put "," into pSeparator
Cheers,
Steve
www.theworcestersource.com
-
- Posts: 47
- Joined: Sat Nov 17, 2007 6:04 pm
Thanks for the nice comment about the blog!
The tree component isn't far off being finished now. I'm currently in the middle of writing the manual to go with it. I'll probably be stuck indoors this weekend (rain, rain, go away!) and may have a beta by the end of Sunday.
I doubt that finding a few testers won't be too hard!
Steve
www.theworcestersource.com
The tree component isn't far off being finished now. I'm currently in the middle of writing the manual to go with it. I'll probably be stuck indoors this weekend (rain, rain, go away!) and may have a beta by the end of Sunday.
I doubt that finding a few testers won't be too hard!
Steve
www.theworcestersource.com