Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Date Range Post Reply Post New Topic
Author Message
SamD
Newbie
Newbie


Joined: 24 Oct 2011
Online Status: Offline
Posts: 15
Quote SamD Replybullet Topic: Date Range
     Posted: 27 Oct 2011 at 12:53pm
I have a date range question or how it can be done
I have a date in and date out field also create a parameter date range field.
 
example:
input field: Date Range Parameter = 10/01/2011 to 10/27/2011
Date out = 09/01/2011 Date out = 11/25/2011   
 
Since my parameter field criteria does not fit the date in and date out field
my information will not pull out. I would like my date range parameter to

analyze the date out/date in and if the date range parameter falls in between to extract the data.

 
Thanks!
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 28 Oct 2011 at 2:01am
Are you saying that if the DATE IN and DATE OUT fall in between the PARAMETER that you want to pull the records?

If so, you should be able to put something into the Record section of Selection Formulas:

{table.DATEIN}>=minimum({?DateParam})
and
{table.DATEOUT}<=maximum({?DateParam})
|< /\ '][' ( )
IP IP Logged
SamD
Newbie
Newbie


Joined: 24 Oct 2011
Online Status: Offline
Posts: 15
Quote SamD Replybullet Posted: 28 Oct 2011 at 4:08am
Thanks for the reply.
I've tried that and still not correct.
{@Date In} >= minimum  ({?Date Range}) and
{@Date Out} <= maximum ({?Date Range})
 
Say rental truck #12 rented for 2 months,  Date Out = 09/07/2011 and Date In = 11/07/2011
 
My ?date range parm: Date Out = 10/01/2011 (min ? Date Range), Date In = 10/28/2011 (max ? Date Range)
 
 
My problem is Truck #12 should be included since it met the criteia, but it's not showing up on my report. I've tried replacing  the "and" with "or" but that pulls everything.
 
Hope this make sense.
 
 


Edited by SamD - 28 Oct 2011 at 5:27am
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 28 Oct 2011 at 5:22am
Okay, I see what you're trying to do now. If the truck is out between those dates then it should display. I believe you will have the switch the formula around then.

{table.DATEOUT}<=minimum({?DateParam})
and
{table.DATEIN}>=maximum({?DateParam})


That should get you the results where the truck was rented before the date parameter and returned after the date parameter.

|< /\ '][' ( )
IP IP Logged
SamD
Newbie
Newbie


Joined: 24 Oct 2011
Online Status: Offline
Posts: 15
Quote SamD Replybullet Posted: 28 Oct 2011 at 5:33am
No, that did not work either...  zero result when I switch it around.
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 28 Oct 2011 at 5:42am
I'm really not sure then. Logically speaking, that should display whatever record had a DATEOUT before the parameter and a DATEIN after the parameter.

I know it sounds mundane, but try putting parenthesis around the entire statement. Not sure why that would affect it, but sometimes it does.
|< /\ '][' ( )
IP IP Logged
SamD
Newbie
Newbie


Joined: 24 Oct 2011
Online Status: Offline
Posts: 15
Quote SamD Replybullet Posted: 28 Oct 2011 at 9:45am
Thanks!
 
I got it working, figured out it was the date conversation error.
 
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