Solved

Crystal Reports formatting phone number

Posted on 2014-04-18
2
2,971 Views
Last Modified: 2014-04-22
I have the following formula to format a phone number:

Picture(ToText({TABLE.FIELD}), "(xxx) xxx-xxxx")

But the result contains 2 decimal places, such as (555) 123-4567.00

Why is the .00 on there when I am converting it to text? I have tried:

Picture(ToText(Round({TABLE.FIELD},0)), "(xxx) xxx-xxxx")

But I still get the .00
0
Comment
Question by:altosax
2 Comments
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Unless you tell ToText and CStr how to format the number, it uses the system default which is generally 2 decimals

Try

Picture(ToText({TABLE.FIELD},0,""), "(xxx) xxx-xxxx")

That says 0 deicmal places and no thousands separator

You could also use

Picture(ToText({TABLE.FIELD},"0000000000"), "(xxx) xxx-xxxx")

mlmcc
0
 
LVL 34

Accepted Solution

by:
James0628 earned 500 total points
Comment Utility
If any of your phone numbers are 7 digits, with no area code, you may want to try to handle that.  mlmcc's second suggestion would put 0's where the area code would be, which may be good enough.  Another option would be the following, which would leave the area code blank if there were only 7 digits.

Picture(ToText({TABLE.FIELD}, "##########"), "(xxx) xxx-xxxx")


 James
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now