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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any formulas to get read of comas in numeric field?Right click->Format 2

Status
Not open for further replies.

Katya85S

Programmer
Jul 19, 2004
190
Any formulas to get read of comas in numeric field?
Right click->Format Field won't help.

To be particular, below is what i need in the project:
I want to display numeric field in xxx-xx-xxxx format.
The formula, lets call it @myFormating used is
picture (cstr({myNumericField}), "XXX-XX-XXXX")

Let say, the value in myNumericField is 64629925. In the report it
Crystal report automatically, behind the scene, transfers values of myNumericField into format with comas and decimals: 64,629,925.00
Then correspondently for this value in Crystal report @myFormating formula displays: 64,-62-9,925.00.
Though what I want should be 064-62-9925

Is there a way around?

Thank you all in advance.
 
ToText first

Totext(numberfield, 0,"")

First argumement ensures no decimals, second removes thousand separators

Ian
 
CStr and ToText are interchangeable:

picture (cstr({myNumericField},0,""), "XXX-XX-XXXX")

~Brian
 
I got it.
Thank you all.
I have created SQL Expresion Field
convert(char,right(10000000000+myNumericField,9))
and then applied this one to a picture function.
 
And thank you guys, Ian and Brian, for your posts. they work greatly and i believe are more efficient then my SQL Expresion Field.
Thanks much!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top