Find the Latest Date in a List

HotDocs Version:HD6, HD2005, HD2006, HD2007, HD2008, HD2009
Word Processor:Microsoft Word, WordPerfect
Added to Knowledge Base:September 2004

When you have repeated variables in your templates, you may want to find which value meets a certain condition. For example, if you have a list of revision dates, you may want to determine which date is latest.

In this example, the dialog containing a Date variable is repeated. The result of the computation is initialized with the first answer in the list, and in each subsequent repetition, if the date is greater (later) than the result, the result is set to that date. After all repetitions are processed, the result is the latest date in the list.

Example:
Date Var 
REPEAT Repeat Dialog 
  IF Date Var > RESULT 
    Date Var 
  END IF  
END REPEAT 

 Date Var

Any Date variable in a repeated dialog (Repeat Dialog).

 Repeat Dialog

Any repeated dialog containing a Date variable (Date Var).