Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Comparing Dates from two fields Post Reply Post New Topic
Author Message
skalecm
Newbie
Newbie


Joined: 18 Feb 2010
Location: United States
Online Status: Offline
Posts: 1
Quote skalecm Replybullet Topic: Comparing Dates from two fields
     Posted: 18 Feb 2010 at 7:01am

I need to run a crystal report that will select all items that came into our department during a date range defined by the user (running the report)(I use parameters function for the date query).  I then need to compare the "Arrive Date" (Calibration.C2316) of the current record (11 of 11) against the previous record's "Due Date" (Calibration.C2303), this would be record (10 of 11).  The report will only list items that have been turned in past their due date.

 

From the coding below, I do get the items that were brought into the Department.

The "problem" is when I add this code:

{Calibration.C2316} > previous ({Calibration.C2303})

Crystal Reports gives the following error:  "This function cannot be used because it must be evaluated later."

 

Do you have any ideas how this can be done???

 

// Check for Active Assets

{Inventory.I4299}='A' and

//  Select only days in a date range

{Calibration.C2316} > {?Begin_Date} and

{Calibration.C2316} < {?End_Date} and

//  Compares the Arrive Date in current record to Due Date in previous record

{Calibration.C2316} > previous ({Calibration.C2303})

Skalecki
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 18 Feb 2010 at 9:10am

You can't filter this in Crystal.   In order to filter the data correctly, you'll have to write a SQL command that will do this for you.

However, you could remove this from your selection criteria and then suppress the data lines that don't meet your criteria by using a formula to suppress the section.  Open up the Section Expert and select the section where your data is located.  DO NOT check Suppress.  Instead click on the formula button to the right of the suppress checkbox and enter:
 
{Calibration.C2316} = previous ({Calibration.C2303})
 
The problem with this approach is that any Arrive Date with a Due Date prior to your {?Begin_Date} is not going to be included on the report.  That's why it will be better to determine how to do this in SQL and use a command.
 
-Dell
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