Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Date syntax issue Post Reply Post New Topic
Author Message
JTanzey
Newbie
Newbie


Joined: 08 Dec 2011
Online Status: Offline
Posts: 2
Quote JTanzey Replybullet Topic: Date syntax issue
     Posted: 08 Dec 2011 at 2:32pm
I am having trouble with a simple record selection. I have a date field that I want to have the report show me all records where the date in this field is 45 day or older.
 
In SQL I use the getdate () > -45 function, but crystal does not have it.
 
So I tried to use the DateAdd with this {CrewTracking.DateCompleted} = DateAdd ("d", -45, {CrewTracking.DateCompleted}) but it is not returning any records.
 
If I chage the -45 to 0 it returns all records.
 
Any help here would be great.
 
Thanks
Jay
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Dec 2011 at 2:21am
{CrewTracking.DateCompleted} <=DateAdd ("d", -45, currentdate)

You may need to use > as I was not sure which direction you meant as older than
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 09 Dec 2011 at 3:36am
currentdate is the CR equivalent of GETDATE().
 
and yeah, like DBlank said, it may be a you need to change the sign.
 
 
IP IP Logged
JTanzey
Newbie
Newbie


Joined: 08 Dec 2011
Online Status: Offline
Posts: 2
Quote JTanzey Replybullet Posted: 09 Dec 2011 at 1:27pm
That works thanks for the help
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