Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Display just Date from DateTime field? Post Reply Post New Topic
Author Message
SimonPCFP
Newbie
Newbie


Joined: 30 Nov 2012
Online Status: Offline
Posts: 12
Quote SimonPCFP Replybullet Topic: Display just Date from DateTime field?
     Posted: 15 Jan 2013 at 6:02am
Insanely green Crystal user trying to display just the Date from a DateTime field...here is my attempt at code, based off Mr Bischof's Crystal Reports XI Encyclopedia.


Global DateVar ReceiptDate;

WhilePrintingRecords;

ReceiptDate:= Date{LUGS_TRANSACTION.LUG_TRANSACTION_Date};

Getting an error - "The remaining text does not appear to be part of a formula", and the database field is highlighted.

Please advise and thanks so much!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 15 Jan 2013 at 6:35am
totext({table.field}, "MM/dd/yyyy")
IP IP Logged
SimonPCFP
Newbie
Newbie


Joined: 30 Nov 2012
Online Status: Offline
Posts: 12
Quote SimonPCFP Replybullet Posted: 15 Jan 2013 at 9:03am
Thanks so much!

Just the single line of code required? No variable assignment?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 15 Jan 2013 at 9:39am
not if you are just displaying it.
If you would like to use it somewhere else as a string you would assign it.
 
CR will display the last row of a formula, so no assignment is necessary. In addition, you can use this fact to 'hide' output of a formla...the formula can do whatever you need it to, but if you don't want to see any results on the report, just put "" as the last line, and for all intents and purposes the formula is invisible.
 
You should be able to format the field as well in the Edit Object for the cell.
Glad I could help
IP IP Logged
SimonPCFP
Newbie
Newbie


Joined: 30 Nov 2012
Online Status: Offline
Posts: 12
Quote SimonPCFP Replybullet Posted: 15 Jan 2013 at 10:06am
Thank you so much for your reply!

I am no longer getting the error, but no display either. I may have a linking issue..investigating!

Thanks again ~
IP IP Logged
SimonPCFP
Newbie
Newbie


Joined: 30 Nov 2012
Online Status: Offline
Posts: 12
Quote SimonPCFP Replybullet Posted: 15 Jan 2013 at 1:30pm
Got it working! Thanks so much lockwelle~
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