Solved

Crystal Reports formatting phone number

Posted on 2014-04-18
2
3,550 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 40009833
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 35

Accepted Solution

by:
James0628 earned 500 total points
ID: 40010241
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

691 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