Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: date comparison Post Reply Post New Topic
Author Message
Jan (Newbie)
Newbie
Newbie


Joined: 27 Feb 2013
Online Status: Offline
Posts: 3
Quote Jan (Newbie) Replybullet Topic: date comparison
     Posted: 28 Feb 2013 at 4:06am
Need help determining the best way to compare three different date fields and then select the minimum date from the three; then, select only the records containing the resulting date which must also be within a given date parameter 

Edited by Jan (Newbie) - 01 Mar 2013 at 3:38am
Jan
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 01 Mar 2013 at 2:00am
HI

Create the following to find minimum date :

datevar d1:=date1;
datevar d2:=date2;
datevar d3:=date3;

If d1 < d2 and d1 < d3 then
d1
else
if d2 < d1 and d2 < d3 then
d2
else
d3

Now using the above formula you can filter your records like

{@minimumdate} = {databasefield}
Thanks,
Sastry
IP IP Logged
Jan (Newbie)
Newbie
Newbie


Joined: 27 Feb 2013
Online Status: Offline
Posts: 3
Quote Jan (Newbie) Replybullet Posted: 01 Mar 2013 at 3:41am
Thank you for your response.
 
I wrote the formula with a slight variation in that I had to you DateTime variable and it worked...thankyou!
 
I still need some help on selecting the results of the formula by a parameter range...
Jan
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