Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Date Range Within a Date Range? Post Reply Post New Topic
Author Message
DakJ
Newbie
Newbie


Joined: 15 Jun 2010
Online Status: Offline
Posts: 3
Quote DakJ Replybullet Topic: Date Range Within a Date Range?
     Posted: 15 Jun 2010 at 6:20am
I am trying to make a report for a jail system using crystal reports 10 that displays inmates that were in jail during a specific range of dates entered through start date and end date parameters.  The problem is our jail system only records the date the inmate came to jail and the date he left, with no data in between.
 
So if I was to enter a start date of 7/1/09 and an end date of 6/1/10 how would I make inmates with a jail commit date of 5/5/09 and a release date of 6/11/10 show on the report?  Also if they dont have any release date could I still have them show up on the report?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Jun 2010 at 7:13am
You have to write your select statemnt to handle the instances you want to include. I think this will work:
@startdate in table.startdate to (if isnull(table.enddate) then today else table.enddate)
or
@enddate in table.startdate to (if isnull(table.enddate) then today else table.enddate)


Edited by DBlank - 15 Jun 2010 at 7:13am
IP IP Logged
DakJ
Newbie
Newbie


Joined: 15 Jun 2010
Online Status: Offline
Posts: 3
Quote DakJ Replybullet Posted: 15 Jun 2010 at 7:27am
That... was exactly what I was looking for.  Thanks!
IP IP Logged
DakJ
Newbie
Newbie


Joined: 15 Jun 2010
Online Status: Offline
Posts: 3
Quote DakJ Replybullet Posted: 16 Jun 2010 at 4:23am
After reviewing the report in more detail while it has almost everyone that needed to be on there.  For some odd reason some people that should be in there aren't showing up.  It seems people that have commit and release dates that fall within the set parameters are not displaying on the report, for example...
 
Start Date Parameter set to 7-1-07
Release Date Parameter set to 6-30-08
 
Inmates Commit date - 9-13-07
Inmates Release date - 3-12-08
 
(Edit)
Directly after posting that I realized adding
 
or
@table.startdate in @startdate to @enddate
or
@table.enddate in @startdate to @enddate

 
to the previous code seems to work.
 
 


Edited by DakJ - 16 Jun 2010 at 4:34am
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