Print Page | Close Window

Date Calculation question

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=139
Printed Date: 02 May 2025 at 12:26am


Topic: Date Calculation question
Posted By: jlaz
Subject: Date Calculation question
Date Posted: 19 Jan 2007 at 11:03am

Hi,

I am in the process of creating a report that will report the number of permits that have met date event milestones. Each permit has a number of milestones to meet (example below) and the dates are calculated using the dates in the EventDesc column. The question I have is this: Using the example table and data below, how can I calculate the date difference (in days) between say EventDateID (7) and EventDateID (3) :

PermitID    PermitNum   EventDate   EventDesc   EventDateID
---------------------------------------------------------------------------------
23               PSD-1206      5/11/06     App Received             1
23               PSD-1206      5/25/06     Determination            2
23               PSD-1206      7/25/06     Complete App Rec      3
23               PSD-1206      8/25/06     Process                      5
23               PSD-1206      9/25/06     Disclosure                  6
23               PSD-1206      11/22/06    Final Decision            7


I tried using the PreviousValue function, but that only allows calculation between the record previous to it like EventDateID (7) and (6) above. I am using Crystal Report version 10, SQL Server 2000 as backend DB and stored procedure.
Thanks




Replies:
Posted By: BrianBischof
Date Posted: 19 Jan 2007 at 11:15am
That's quite a trick since the records are spread so far apart and different calculations will use data from different records. I recommend creating global variables (or an array depending how complex this gets) and for every record check to see what the ID is and store it in a particular variable. Then when the report is finished all the variables will have dates and you can do whatever calculations you want to do with them.

-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>



Print Page | Close Window