Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Date to select records...

Status
Not open for further replies.

Timmkatt

IS-IT--Management
Sep 28, 2006
71
0
0
US
Crystal Reports 10. I have two fields,
Reservation.insert.date and Scheduled.Ride.Date. I need my report to show only the scheduled rides booked 7 or more days ago. Sort of like "Show me all records where Scheduled.Ride.Date is greater than or = to 7 days older than Reservation.insert.date". Any way this can be accomplished in the select expert with a formula? I would rather not have the user need to use parameters to accomplish this if there is another way. Thanks.
 
You have to do this in the selection formula, not the select expert. The formula would be something like:

{Reservation.insert.date} - {Scheduled.Ride.Date} >= 7

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Or you can use:

datediff('d',{Reservation.insert.date} - {Scheduled.Ride.Date}) >= 7
 
BOjdh2n probably meant to write:

datediff('d',{Reservation.insert.date}, {Scheduled.Ride.Date}) >= 7

If you insert a SQL expression {%diff} like:

datediff('d',`Reservation`.`insert.date`, `Scheduled`.`Ride.Date`)

...and then use a record selection formula like:

{%diff} >= 7

...the record selection formula will pass to the SQL statement.

-LB
 
Thanks,

Good catch and recomendation for passing the SQL to the DB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top