Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Dates for recurring report Post Reply Post New Topic
Author Message
achandana01
Groupie
Groupie
Avatar

Joined: 20 Jul 2011
Online Status: Offline
Posts: 59
Quote achandana01 Replybullet Topic: Dates for recurring report
    Posted: 01 Jul 2014 at 11:14am
Hi,

I am working on a report where I need to caputure all admitted patients on Friday @ 12:01am and discharged by Sunday @ 12:01am.

This report will be run on every Monday and it captures previous weekend data.I am not sure how to put it in select criteria so that the report can run on every Monday without changing dates.

Thanks,
chand
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 01 Jul 2014 at 12:55pm
As long at the run time is consistent then you could always use an the dateadd function for the beginning and ending dates, something like this dateadd("d",{DateField}, -3) and dateadd("d",{DateField},-1). You should to concatenate the time in.  My brain just can't quite think how to do it at the moment.
IP IP Logged
Gurbs
Senior Member
Senior Member
Avatar

Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Quote Gurbs Replybullet Posted: 01 Jul 2014 at 9:13pm
Can you describe the tables? Are both dates in the same table? And if not, how are they linked?
IP IP Logged
achandana01
Groupie
Groupie
Avatar

Joined: 20 Jul 2011
Online Status: Offline
Posts: 59
Quote achandana01 Replybullet Posted: 02 Jul 2014 at 4:06am
@gurbs yes both dates are in the same table
chand
IP IP Logged
achandana01
Groupie
Groupie
Avatar

Joined: 20 Jul 2011
Online Status: Offline
Posts: 59
Quote achandana01 Replybullet Posted: 02 Jul 2014 at 4:07am
@Kevlray

lets say the run time is not consistent for example I ran this report on Wednesday instead of Monday how could I still able to get data for friday thru sunday ?
chand
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 02 Jul 2014 at 5:44am
Nope.  In fact I goofed.  The only way it would work if I used a filter using the current date i.e.,  {Datefield} >= dateadd("d",currentdate, -3) and {Datefield} <= dateadd("d",currentdate,-2).  This should be a close approximation (I did not consider the time of day) and it would have to be run on Monday.  Do you have a way to schedule a report?  I hope this gets you in the right direction.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Jul 2014 at 7:36am
you might be able to simplify this to using the weekday value from your dataset
something like
datediff(day,admitdate,currendate)<5 and
datepart('w',admitdate) in [6,7,1] and
datediff(day,dischargedate,currendate)<5 and
datepart('w',dischargedate) in [6,7,1] and
 
 
IP IP Logged
achandana01
Groupie
Groupie
Avatar

Joined: 20 Jul 2011
Online Status: Offline
Posts: 59
Quote achandana01 Replybullet Posted: 02 Jul 2014 at 10:02am
Thanks Dblank it worked for me :)
chand
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.