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!

How to remove commas from a number 1

Status
Not open for further replies.

fa721

Technical User
Jul 18, 2003
3
US
Hello,
Phone numbers on my report (Crystal Reports 8.5) come out as:
xxx,xxx,xxxx (number field)

I want to change the format so they would be displayed as:
(xxx) xxx-xxxx

I am using the Picture and ToText functions to create a new field with the right format in the field Editor. However, what I have not been able to figure out is how to first remove the commas from the number. Can anybody help? Am I on the right track Picture and ToText functions? What is the best way to resolve this problem?

Your help will be greatly appreciated.

Fa721

 
replace(toText({numberField},",","")
 
Try this:

Picture( Replace( {phone_field}, ",", "" ), "(xxx) xxx-xxxx")
 
Thanks this is great!

I just realized that the original format is:
XXX,XXX,XXXX.00
How do I use the 'replace' function to get rid of commas as well as the decimal point and trailing zeros in one formula.

i would appreciate it if you would be kind enough to write the whole formula from start to end for me. I've trying and I keep getting errors.

Thanks again.

Fa721
 
picture(totext({YourNumberField},0,""),"(xxx) xxx-xxxx")

works for me on a number field.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top