Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Display earliest date Post Reply Post New Topic
Author Message
macke
Newbie
Newbie


Joined: 19 Mar 2009
Location: United Kingdom
Online Status: Offline
Posts: 14
Quote macke Replybullet Topic: Display earliest date
     Posted: 13 Aug 2010 at 2:55am

I have a formula which displays 1 of 2 fields.

if isnull ({SOP_ITEM.DUE_DATE}) then {SALES_ORDER.DESPATCH_DATE}
else {SOP_ITEM.DUE_DATE}
 
What I would like it to do is display the earliest date in the list.
 
The value in SALES_ORDER.DESPATCH_DATE can only be 1 value, but on SOP_ITEM.DUE_DATE it can be different for every line item on the order.
 
macke
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 13 Aug 2010 at 3:17am
if isnull ({SOP_ITEM.DUE_DATE}) then
  {SALES_ORDER.DESPATCH_DATE}
else
  IF DATEDIFF("d", {SOP_ITEM.DUE_DATE}, {SALES_ORDER.DESPATCH_DATE}) > 0 THEN
    {SALES_ORDER.DESPATCH_DATE}
  else
    {SOP_ITEM.DUE_DATE}
 
 
just double check the syntax for the datediff function and the order the parameters...the syntax is slightly different than SQL (where I do most of my work) and the order I can never keep straight.
 
HTH
IP IP Logged
macke
Newbie
Newbie


Joined: 19 Mar 2009
Location: United Kingdom
Online Status: Offline
Posts: 14
Quote macke Replybullet Posted: 13 Aug 2010 at 3:24am
Brilliant!!  Thank you
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