Humpy
Humpy

Reputation: 2012

How to filter dates older than 3 days in Crystal Reports?

I'm currently working a project that requires a report. I have never used any type of reporting before but I have researched and many people use Crystal Reports. I have implemented this into my project and and customized it pretty well. However, I am a bit stuck because I don't know how to do the next step. We deal with "deals" for cars. Once a deal is sent in, we keep track of it. These deals have what we call a "deal date" which is the date that deal was finished. What I need is a way to filter these deal dates to show up on this report. For example, if the deal date was yesterday (06/25/2013), I need this deal to show up on the report 3 days or more after that date. So if it is 06/28/2013 then that deal will show up on the Crystal Report. Does anyone have any suggestions on how to go about this? Keep in mind that I have never used Crystal Reports before so I'm no exactly sure where to begin. I have searched to do something like this but have come up empty handed. Currently the Report views all the "deals" (which is thousands of rows) in the database. Any help is appreciated! Thank you! If anymore information is needed, please let me know!

Upvotes: 0

Views: 4390

Answers (1)

craig
craig

Reputation: 26262

Given:

      D1    D0    T
<--|--|--|--|--|--|-->
  -5 -4 -3 -2 -1  0
  • D0: a deal that occurred 2 days ago
  • D1: a deal that occurred 4 days ago

Assuming:

  • Want D1
  • Don't want D0

Then:

Select Report | Selection Formulas | Record...

Enter the following formula:

(CurrentDate - {table.date_field}) > 3

To convert a string to a date, use this syntax:

( CurrentDate - DateValue({table.string_field}) ) > 3

Upvotes: 1

Related Questions