Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formatting a string Post Reply Post New Topic
Author Message
Hammerklavier
Newbie
Newbie


Joined: 24 Oct 2011
Online Status: Offline
Posts: 24
Quote Hammerklavier Replybullet Topic: Formatting a string
    Posted: 24 Oct 2011 at 6:03am
I'm sorry if this is a bad question, or if it has already been asked many times, but I'm having a surprisingly difficult time finding the information I need on this, so hopefully someone here can help.
 
My data comes from a SQL database, and I have a phone field with a default format of 111-111-1111.  I want to change this format to (111) 111-1111. 
 
I assume it has something to do with the split() method, but I'm not sure where or how to apply it in Crystal Reports XI (I'm new to Crystal Reports in general).  Help would be greatly appreciated.
 
Thank you,
 
Hammerklavier 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Oct 2011 at 6:54am
one way...
'(' & left(table.phone,3) & ') ' & right(table.phone,8)
IP IP Logged
Hammerklavier
Newbie
Newbie


Joined: 24 Oct 2011
Online Status: Offline
Posts: 24
Quote Hammerklavier Replybullet Posted: 24 Oct 2011 at 7:11am
Thank you, DBlank.  This works.
 
Is it possible to use variables for formula fields in the Formula Workshop?  I was envisioning using the split() method to create an array with the different pieces of the phone number.  It doesn't look like this will be necessary here, but it's something I've been wondering about with Crystal Reports XI.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Oct 2011 at 7:16am

yes you could use a variable formula with split and then splice it back togther as you so desired. it would be done in the fomrula editor.

I am not comfortable with array formulas so I used the a different method.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.