Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Removing decimal places from DatePart output Post Reply Post New Topic
Author Message
Andy Parker
Newbie
Newbie


Joined: 18 Aug 2011
Online Status: Offline
Posts: 5
Quote Andy Parker Replybullet Topic: Removing decimal places from DatePart output
    Posted: 18 Aug 2011 at 10:38pm
I am using Crystal Reports to interigate a GoldMine database.
I am using the DatePart function to return the quarter number from the opportunity start date - "Quarter " & round(datepart ("q", {OPMGR.STARTDATE})) but it is returning a number with 2 decimal places e.g. 1.00 As you can see I have tried the round function to solve this but it to no avail. I still get 1.00 returned on the report.
Any suggestions as to how I can solve this?
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 18 Aug 2011 at 11:34pm
You should be able to right click and choose "Format Field". There is a format number section where you can set it to show with no decimals.
IP IP Logged
Andy Parker
Newbie
Newbie


Joined: 18 Aug 2011
Online Status: Offline
Posts: 5
Quote Andy Parker Replybullet Posted: 19 Aug 2011 at 12:05am
That works as long as you haven't included some text in the same formula in which case the Format Field dialog box seems to treat the whole field as a text field and doesn't give you options you get with a number field. Your reply prompted me to try taking out the text in the formula, formatting the number field (which worked) but as soon as I added the text back I got the decimal places back. Because this is in a cross tab table I can't add the text and number formula separately either.
I don't really undersand why the round function isn't working in the formula either.
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 19 Aug 2011 at 12:53pm
You might try placing the field in a text box and then adding the text but I don't know if you can then format the field inside the text box.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Aug 2011 at 4:22am
"Quarter " & totext((datepart ("q", {OPMGR.STARTDATE})),0,"")
IP IP Logged
Andy Parker
Newbie
Newbie


Joined: 18 Aug 2011
Online Status: Offline
Posts: 5
Quote Andy Parker Replybullet Posted: 23 Aug 2011 at 5:49am
Sorted, the ToText function did the job. Many thanks for your help.

Edited by Andy Parker - 23 Aug 2011 at 5:50am
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.