Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stupid Formatting Ticks 2

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,826
JP
All,
Feeling the pain once again of the 10+ year hiatus. I think this is simple, but can't find any reasonable reference in any of the docs.
Here's the scenario:
I have a table, with 3 fields, 1 is currency, the other to are integer.
On my form I have the fields display into a text box. They are calculated fields, and don't get edited by users.
I for some reason thought the currency field type would automatically display the value with a currency symbol (as set in defaults) with comma separators for values over 1000 and with 2 decimal places.
I also thought the integer values would display with comma separation, but neither do. I've played with several formats, but the documentation is so vague here, I don't know if they go on input mask or format, but I've tried a few examples, and both types seem to fail. The best I got was a $ in the currency field, but still couldn't get it to sort the decimals (it comes up with 4) and no comma digit grouping.
What's the best approach for this kind of thing?


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
InputMask will allow you to display your value correctly on the form.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Ok, but what needs to go into the mask if I want 2000.0000 to look like $2,000.00 ?


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
TRANSFORM(currencyfield) will give you the string output with decimal point, 1000s separator and currency symbol definitions.
I don't know what you talk about when you mention expecting a comma for integers, though, as comma separated values?
Are you looking for COPY TO TYPE CSV or EXPORT? It doesn't seem so, as you talk of a form.
A textbox may display either of your three fields, when binding to it, but not two at once.

Also the textbox has specific properties for dates, but not for currencies. If you don't remember how inconsistent VFP often is with things, then welcome back to that "horror". It's not all that complicated, though.

So one question back: What do you want to do with the two integers and what did you do, what's the code about them, the controlsource and binding?

Bye, Olaf.
 
Hi Olaf,
Thanks, I'll try this. Sorry, my terminology is getting interwoven... comma separation for integers I should have stated the same as "digit grouping" for values over 999.
-S

Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
In regard to currency:

? Transform(Ntom(2000.13))
? Transform(Ntom(2000.13),"@$ 999,999.99")
And inputmask tells about $ and $$. Everytime you want to make use of the input mask as formatting output use R in the format, that's also how TRANSFORM treats everything after @R and a space as mask.

Bye, Olaf.
 
Scott
If I put $9,999.99 in a textbox associated with a currency fields with the value 1000.000 I will see $1,000.00 in the textbox.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks guys... Perfect, and I know this was basic, but I couldn't find any prior example where I had done this!
The best I had come up with was a function I had created years ago to treat them as character values for storage purposes, and then converted them to numeric values if there were any calculations to be done against them (and that's just tedious).

So, many thanks. A "first" apparently even after all these years.


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top