Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Removing comma from year Post Reply Post New Topic
Author Message
pgiering
Newbie
Newbie


Joined: 25 Aug 2009
Location: United States
Online Status: Offline
Posts: 37
Quote pgiering Replybullet Topic: Removing comma from year
     Posted: 11 Dec 2009 at 10:21am
Hi,
 
I have a formula that I use in my header to display the year.
 
The year is the result of a calculation, and it is working fine, but it wants to display a comma after the first digit (because it thinks it is a number and is applying a thousands separater).
 
the piece of the formula that calculates the year is:
 
totext({glperiod.year}-{?Current Year},0)
 
I'm using the ,0 expression to drop decimals, but I don't know how to drop the comma.
 
Thanks,
 
Paul
 


Edited by pgiering - 11 Dec 2009 at 10:22am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Dec 2009 at 10:56am
totext({glperiod.year}-{?Current Year},0,'')
//single quotes
IP IP Logged
pgiering
Newbie
Newbie


Joined: 25 Aug 2009
Location: United States
Online Status: Offline
Posts: 37
Quote pgiering Replybullet Posted: 11 Dec 2009 at 2:28pm
Thanks, DBlank!
 
I noticed that it also worked with a double quote, is there a difference in what the single vs. double quote will do?
 
Paul
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Dec 2009 at 2:40pm
Not really a difference in crystal syntax (as far as I know).
I tend to use singles because it is a SQL habit.
A caveat...
In crystal you may need to alternate use of these sometimes in different functions like instr()
Say you want to search a field for Pat's Place.
You would need to use the double quotes because the value has a single in it: instr(field,"Pat's Place")
Conversely search for The title is "Travel on a Dollar a Day"
You would need to use single quotes because your value is using the doubles: instr(field,'The title is "Travel on a Dollar a Day"')


Edited by DBlank - 11 Dec 2009 at 2:42pm
IP IP Logged
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