Skip to content

Flow documentation · legacy product

CompareDate ​

Declaration ​

Function CompareDate(const ADate, BDate: TDateTime): TValueRelationship

Example ​

pascal
procedure OnMapEvent(var Value:Variant);
begin
// compare two dates ...
if  CompareDate(ORDER['DUE_DATE'].Value, Date) = LessThanValue then
// Due Date is backdated ... use today's date instead
 Value := Date
else
// Due Date is not backdated ... use as is
Value := ORDER['DUE_DATE'].Value;
end;

Description ​

Compares two TDateTime values and returns "less", "equal" or "greater". Ignores the Time part if both values have the same date portion.

TValueRelationship represents the relationship between two values. Each of three TValueRelationship values is pre-declared as a named constant:

  • LessThanValue = -1 // The first value is less than the second value.
  • EqualsValue = 0 // The two values are equal.
  • GreaterThanValue = 1 // The first value is greater than the second value.

CompareDate results in:

  • LessThanValue if ADate occurs on a day prior to the Date part of the BDate.
  • EqualsValue if date parts of both ADate and BDate are the same, ignoring the Time part.
  • GreaterThanValue if ADate occurs on a day that follows the Date part of the BDate.