Link to home
Start Free TrialLog in
Avatar of altosax
altosax

asked on

Crystal Reports formatting phone number

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
Avatar of Mike McCracken
Mike McCracken

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
ASKER CERTIFIED SOLUTION
Avatar of James0628
James0628

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial