Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: DATE DIFF Post Reply Post New Topic
Author Message
MFORD
Newbie
Newbie


Joined: 13 Mar 2008
Location: United States
Online Status: Offline
Posts: 6
Quote MFORD Replybullet Topic: DATE DIFF
    Posted: 01 May 2008 at 1:00pm
How do I calculate a date difference if sometimes the closeddate is a null value? Here is my formula:

datevar d1;
datevar d2;

d1 := date({CallLog.RecvdDate});
d2 := date({CallLog.ClosedDate})

DateDiff ("d", d1, d2) -
     DateDiff ("d", d1, d2) -
     DateDiff ("d", d1, d2
MF
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 01 May 2008 at 9:56pm
I don't understand why in your formula you listed DateDiff() three times. Nonetheless, you need to check for null prior to doing the calculation.
If IsNull({CallLog.ClosedDate}) Then
    DateDiff("d", d1, CurrentDate)
Else
    DateDiff("d", d1, d2);

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>
IP IP Logged
MFORD
Newbie
Newbie


Joined: 13 Mar 2008
Location: United States
Online Status: Offline
Posts: 6
Quote MFORD Replybullet Posted: 02 May 2008 at 6:24am
that is what the last user gave me to use-it works when there is a value there however, it does not work if the field has no date in it. I'll try your date diff formula now.
thank you!
MF
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.047 seconds.