Print Page | Close Window

select between 2 dates

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=14763
Printed Date: 03 May 2024 at 3:54am


Topic: select between 2 dates
Posted By: spikestertje
Subject: select between 2 dates
Date Posted: 24 Oct 2011 at 10:39am
In the Oracle database the date/time is stored in a string.
I already have created an SQL expression to sort it ascending as followed:
TO_TIMESTAMP("EVENTS"."EVENTCREATED" , 'DD-MM-YYYY HH24:MI:SS')

No I need to make an option so I can select a start and end date.
for example if I want to select dates between 15-09-2011 25-09-2011.

I already tried to create a parameter for this, but when I select the the time frame, I get everything between 15 & 25-09-2011 but also records from 01-10 and further.

Now I've got two questions:
Do I need to make an expression of parameter field from the string as the "TO_TIMESTAMP"?
How can I create the option, so I can select the start and ending date?

Thank you in advance




Replies:
Posted By: SamD
Date Posted: 24 Oct 2011 at 10:57am
yes, you would need to add a date range in the parameter field.
 
Also, Formula field, create Start Date and End Date
 
ex:
Start Date formula field
Minimum ({?Date Range})
 
End Date formula field
Maximum ({?Date Range})
 


Posted By: lockwelle
Date Posted: 27 Oct 2011 at 3:53am
yes, you would need 2 parameters, one for start and the other for stop.
 
as long as your field is a datetime, like your parameters then a simple formula in the Report/Selection Formulas/Record like:
 
{table.eventCreated} in {?start} to {?end}
 
should work...it will return true only for rows in the date range.
 
HTH



Print Page | Close Window