Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: CurrentDate - 5days Post Reply Post New Topic
Author Message
LindaOSU
Newbie
Newbie
Avatar

Joined: 06 Dec 2010
Location: United States
Online Status: Offline
Posts: 9
Quote LindaOSU Replybullet Topic: CurrentDate - 5days
     Posted: 06 Dec 2010 at 8:48am
Easy question for the experts:
 
What is the crystal syntax for the record selection formula editor that will pull data from today plus data thru five days previous? 
 
We run a daily report that pulls patient data and it should have today'd medication given as well as all instances for the last 5 days.
 
I am thinking something like {table.field} in (CurrentDate - (CurrentDate-5)).  Not correct obviously.
 
Any help would be appreciated greatly. 
 
LindaOSU
 
 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 06 Dec 2010 at 10:43am
Try:
 
{table.field) >= (CurrentDate - 5)
 
-Dell
IP IP Logged
LindaOSU
Newbie
Newbie
Avatar

Joined: 06 Dec 2010
Location: United States
Online Status: Offline
Posts: 9
Quote LindaOSU Replybullet Posted: 06 Dec 2010 at 2:47pm
Yes, this worked.  Thank you!
IP IP Logged
rbescos
Newbie
Newbie


Joined: 10 Aug 2010
Location: United States
Online Status: Offline
Posts: 13
Quote rbescos Replybullet Posted: 07 Dec 2010 at 5:53am
I'm looking for something similar.  I need to display records from the current date 30 days back and 30 days forward.  Can you please show me what that would look like with your example?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Dec 2010 at 6:24am
table.date in dateadd('d',-30,currentdate) to dateadd('d',30,currentdate)
IP IP Logged
rbescos
Newbie
Newbie


Joined: 10 Aug 2010
Location: United States
Online Status: Offline
Posts: 13
Quote rbescos Replybullet Posted: 07 Dec 2010 at 8:13am
Thank you..  It worked out great for me. 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 07 Dec 2010 at 10:15am
When you're working with days, you don't have to use the dateadd function, you can just use the number of days.  So, it could also be:
 
{table.date} in (Currentdate - 30) to (CurrentDate + 30)
 
-Dell
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