Topic: Comparing dates in formula Posted: 17 Jul 2007 at 10:33am
I would like to be able to compare dates to know which was later.
I have Date1 and Date2, where sometimes Date 2 is not set.
If I do this:
if Date2>Date1 then
Date2
else
Date1
I always get Date 2, even when there isn' t a date set in the field. I would like to get Date2 if it is later and if it is not set, use Date1. These values are declared as dates in the table that I pull them from .
Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Posted: 18 Jul 2007 at 7:51am
I tried this much of the formula with the changes and this much works.
--------------------
stringvar x;
IF IsDate(Cstr({Orders.Ship Date})) THEN x:= (Cstr({Orders.Ship Date})) else x := "Nodate"; x;
----------------------
You will need to deal with the 'AND Date2>Date1' issue, I did not have two dates in my sample database to quickly compare. You could also use the totext function of CR instead of the CStr
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