RE: Number To Char
Thanks very much. This is exactly what I was looking for. I found a reference to "Numeric Format Styles" in the documentation, but no reference as to accomplishing it.
Bruce Williams
Announcement
Collapse
The Alpha Software Forum Participation Guidelines
The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
Moderators may also rename posts and threads if they are too generic or do not property reflect the content.
Moderators may move threads if they have been posted in the incorrect forum.
Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.
The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.
Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.
Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.
Bonus TIPS for Successful Posting
Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.
When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.
The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.
When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.
A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.
If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.
When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.
Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
- Be professional in your conduct
- Be kind to others
- Be constructive when giving feedback
- Be open to new ideas and suggestions
- Stay on topic
Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
- Spam.
- Vulgar language.
- Quotes from private conversations without permission, including pricing and other sales related discussions.
- Personal attacks, insults, or subtle put-downs.
- Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
- Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
- Sexually explicit or violent material, links, or language.
- Pirated, hacked, or copyright-infringing material.
- Encouraging of others to engage in the above behaviors.
If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
- Remove the Post or Thread - the content is removed from the forum.
- Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
- Temporarily Ban the User - user is banned from forum for a period of time.
- Permanently Ban the User - user is permanently banned from the forum.
Moderators may also rename posts and threads if they are too generic or do not property reflect the content.
Moderators may move threads if they have been posted in the incorrect forum.
Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.
The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.
Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.
Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.
Bonus TIPS for Successful Posting
Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.
When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.
The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.
When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.
A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.
If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.
When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.
Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less
Number To Char
Collapse
X
-
RE: Number To Char
Hello All,
Just a short note to say a MASSIVE thanks to all who contributed to this thread, I now have a solution, very similar to Ira's function except changed 'Dollors' to 'Pounds' and 'Cents' to 'Pence. Thanks again.
Cheers
Tom
Leave a comment:
-
RE: Number To Char
Reformatted and slashes
function NumberSpell as C(numbvalue as n)
dec = (numbvalue-int(numbvalue))*100
NumberSpell=str(int(numbvalue),255,0,"XBW")+" dollars"+\
if(mod(dec,100)=0,""," and "+\
str(dec,255,0,"XBW")+" cents")
end function
Leave a comment:
-
RE: Number To Char
Reformatted
function NumberSpell as C(numbvalue as n)
dec = (numbvalue-int(numbvalue))*100
NumberSpell=str(int(numbvalue),255,0,"XBW")+" dollars"+
if(mod(dec,100)=0,""," and "+
str(dec,255,0,"XBW")+" cents")
end function
Leave a comment:
-
RE: Number To Char
Ira,
I plagirized your function and made:
function NumberSpell as C(numbvalue as n)
dec = (numbvalue-int(numbvalue))*100
NumberSpell=str(int(numbvalue),255,0,"XBW")+" dollars"+\ if(mod(dec,100)=0,""," and "+\ str(dec,255,0,"XBW")+" cents")
end function
Which sems to work, unless I'm just fooling myself.
Thanks - as always.
Stan
Leave a comment:
-
RE: Number To Char
Stan,
Oops!
Add the backslashes on the 1st two lines of the expression for continuation of the lines.
Regards,
Ira J. Perlow
Computer Systems Design & Associates
[email protected]
Leave a comment:
-
RE: Number To Char
Stan,
It's the Int() function that is giving the problem (or possibly the multiply).
Just try ?int(145.14*100) and you'll see the wrong value. It's basically the Int function checking just the high order digits. Unfortunately, if the number ends up as 14513.999999999999999 (due to binary arithemetic issues), it doesn't have the smarts to check that it's just a rounding error. Here are 2 other ways to do it;
function NumberSpell as C(numbvalue as n)
NumberSpell=str(int(numbvalue),255,0,"XBW")+" dollars"+
if( val(right(str(numbvalue,15,2),2))=0,""," and "+
str(val(right(str(numbvalue,15,2),2)),255,0,"XBW")+" cents")
end function
function NumberSpell as C(numbvalue as n)
NumberSpell=str(int(numbvalue),255,0,"XBW")+" dollars"+
if( mod(int(numbvalue*100+.000000000001),100)=0,""," and "+
str(mod(int(numbvalue*100+.000000000001),100),255,0,"XBW")+" cents")
end function
Regards,
Ira J. Perlow
Computer Systems Design & Associates
[email protected]
Leave a comment:
-
RE: Number To Char
Ira,
I know you're throwing this out as a freebie so I'm not complaining, but here are the results from the interactive editor:
test = 145
? numberspell(test)
= "One Hundred Forty Five dollars"
for i = .01 to .99 step .01;? numberspell(test+i);next
One Hundred Forty Five dollars and One cents
One Hundred Forty Five dollars and Two cents
One Hundred Forty Five dollars and Three cents
One Hundred Forty Five dollars and Four cents
One Hundred Forty Five dollars and Five cents
One Hundred Forty Five dollars and Six cents
One Hundred Forty Five dollars and Seven cents
One Hundred Forty Five dollars and Eight cents
One Hundred Forty Five dollars and Nine cents
One Hundred Forty Five dollars and Ten cents
One Hundred Forty Five dollars and Eleven cents
One Hundred Forty Five dollars and Twelve cents
One Hundred Forty Five dollars and Thirteen cents
One Hundred Forty Five dollars and Thirteen cents
One Hundred Forty Five dollars and Fifteen cents
One Hundred Forty Five dollars and Sixteen cents
One Hundred Forty Five dollars and Sixteen cents
One Hundred Forty Five dollars and Eighteen cents
One Hundred Forty Five dollars and Nineteen cents
One Hundred Forty Five dollars and Nineteen cents
One Hundred Forty Five dollars and Twenty One cents
One Hundred Forty Five dollars and Twenty Two cents
One Hundred Forty Five dollars and Twenty Two cents
One Hundred Forty Five dollars and Twenty Four cents
One Hundred Forty Five dollars and Twenty Five cents
One Hundred Forty Five dollars and Twenty Six cents
One Hundred Forty Five dollars and Twenty Seven cents
One Hundred Forty Five dollars and Twenty Eight cents
One Hundred Forty Five dollars and Twenty Nine cents
One Hundred Forty Five dollars and Thirty cents
One Hundred Forty Five dollars and Thirty One cents
One Hundred Forty Five dollars and Thirty Two cents
One Hundred Forty Five dollars and Thirty Three cents
One Hundred Forty Five dollars and Thirty Four cents
One Hundred Forty Five dollars and Thirty Five cents
One Hundred Forty Five dollars and Thirty Six cents
One Hundred Forty Five dollars and Thirty Seven cents
One Hundred Forty Five dollars and Thirty Eight cents
One Hundred Forty Five dollars and Thirty Eight cents
One Hundred Forty Five dollars and Forty cents
One Hundred Forty Five dollars and Forty One cents
One Hundred Forty Five dollars and Forty One cents
One Hundred Forty Five dollars and Forty Three cents
One Hundred Forty Five dollars and Forty Four cents
One Hundred Forty Five dollars and Forty Four cents
One Hundred Forty Five dollars and Forty Six cents
One Hundred Forty Five dollars and Forty Seven cents
One Hundred Forty Five dollars and Forty Seven cents
One Hundred Forty Five dollars and Forty Nine cents
One Hundred Forty Five dollars and Fifty cents
One Hundred Forty Five dollars and Fifty One cents
One Hundred Forty Five dollars and Fifty Two cents
One Hundred Forty Five dollars and Fifty Three cents
One Hundred Forty Five dollars and Fifty Four cents
One Hundred Forty Five dollars and Fifty Five cents
One Hundred Forty Five dollars and Fifty Six cents
One Hundred Forty Five dollars and Fifty Seven cents
One Hundred Forty Five dollars and Fifty Eight cents
One Hundred Forty Five dollars and Fifty Nine cents
One Hundred Forty Five dollars and Sixty cents
One Hundred Forty Five dollars and Sixty One cents
One Hundred Forty Five dollars and Sixty Two cents
One Hundred Forty Five dollars and Sixty Three cents
One Hundred Forty Five dollars and Sixty Three cents
One Hundred Forty Five dollars and Sixty Five cents
One Hundred Forty Five dollars and Sixty Six cents
One Hundred Forty Five dollars and Sixty Six cents
One Hundred Forty Five dollars and Sixty Eight cents
One Hundred Forty Five dollars and Sixty Nine cents
One Hundred Forty Five dollars and Sixty Nine cents
One Hundred Forty Five dollars and Seventy One cents
One Hundred Forty Five dollars and Seventy Two cents
One Hundred Forty Five dollars and Seventy Two cents
One Hundred Forty Five dollars and Seventy Four cents
One Hundred Forty Five dollars and Seventy Five cents
One Hundred Forty Five dollars and Seventy Six cents
One Hundred Forty Five dollars and Seventy Seven cents
One Hundred Forty Five dollars and Seventy Eight cents
One Hundred Forty Five dollars and Seventy Nine cents
One Hundred Forty Five dollars and Eighty cents
One Hundred Forty Five dollars and Eighty One cents
One Hundred Forty Five dollars and Eighty Two cents
One Hundred Forty Five dollars and Eighty Three cents
One Hundred Forty Five dollars and Eighty Four cents
One Hundred Forty Five dollars and Eighty Five cents
One Hundred Forty Five dollars and Eighty Six cents
One Hundred Forty Five dollars and Eighty Seven cents
One Hundred Forty Five dollars and Eighty Eight cents
One Hundred Forty Five dollars and Eighty Eight cents
One Hundred Forty Five dollars and Ninety cents
One Hundred Forty Five dollars and Ninety One cents
One Hundred Forty Five dollars and Ninety One cents
One Hundred Forty Five dollars and Ninety Three cents
One Hundred Forty Five dollars and Ninety Four cents
One Hundred Forty Five dollars and Ninety Four cents
One Hundred Forty Five dollars and Ninety Six cents
One Hundred Forty Five dollars and Ninety Seven cents
One Hundred Forty Five dollars and Ninety Seven cents
Leave a comment:
-
RE: Number To Char
Or your amount value may reallly be character field based, even though it's all digits.
Leave a comment:
-
RE: Number To Char
Works fine for me.
Try cut and paste with this
NumberSpell=str(int(numbvalue),255,0,"XBW")+" dollars"+\
if(mod(int(numbvalue*100),100)=0,""," and "+\
str(mod(int(numbvalue*100),100),255,0,"XBW")+" cents")
Leave a comment:
-
RE: Number To Char
Thanks Ira and Charlie,
Unfortunately I can't get Ira's function to operate. I have created the function and am trying to call it in a report, using the numeric field 'amount'. Numberspell(amount) when I try to evaluate this I get an "arguement is incorrect data type" error message. I have checked the function and Alpha says it has no errors.
Sorry to be a pain, but I feel so close I would like to achieve my goal.
Many thanks to all who have taken the time to respond to this thread.
Cheers
Tom
Leave a comment:
-
RE: Number To Char
Ron,
You are correct, it must be done by separating out the values. A function example is;
function NumberSpell as C(numbvalue as n)
NumberSpell=str(int(numbvalue),255,0,"XBW")+" dollars"+|
if(mod(int(numbvalue*100),100)=0,""," and "+|
str(mod(int(numbvalue*100),100),255,0,"XBW")+" cents")
end function
(The 2 vertical bars are the backslash line continuation character. Change them back to backslashes)
Regards,
Ira J. Perlow
Computer Systems Design & Associates
[email protected]
Leave a comment:
-
RE: Number To Char
Thomas:
here is a sample application.
it actually calculates peoples ages but I added down in the lower left corner of the customer screen 2 fields to do what you wanted.
type the number in the top field (lower left corner)and then save the record
the bottom field then displays the number as text.
I use this to print checks in a payroll program.
Both are numeric fields
the second one just displays as text
display,right click on field, properties,format
look at the bottom for the display types. (the drop down scrool bar has more than what you initially see)
hope it helps
Charlie Crimmel
Leave a comment:
-
RE: Number To Char
Thanks To Ron and Ira
Apologies for being a bit slow on the uptake. The function outlined by Ira is ideal for this situation, however if I include 2 decimal places, the function will show a fraction say - 25/100. How can I get this to show as .25.
Any help as always greatly appreciated.
Cheers
Tom
Leave a comment:
-
Guest repliedRE: Number To Char
Thanks
I phrased ny question incorrectly, i meant how do i get the decimal part as words, i guess i have to parse the input and make two calls/
Ron
Leave a comment:
Leave a comment: