The HotDocs Computation Archive
Get Extra Help

0073 - Decreasing COUNTER

Description:

Create a dialog counter that counts down rather than up.


• Code •

SET Count-n TO COUNT( RepeatedDialog )
REPEAT RepeatedDialog
   ...
   SET Count-n TO Count-n - 1
END REPEAT

• Explanation •

This script creates a custom counter, Count-n (a number variable) that counts backward to 1. For illustration, we'll assume a repeated dialog containing five answers. On the first pass of the REPEAT, Count-n will be 5 (COUNT will be 1). On the second pass, Count-n will be 4 (COUNT will be 2). On the last pass, Count-n will be 1 (COUNT will be 5).

Make sure that SET Count-n TO Count-n - 1 is the last line of the REPEAT.

 

• Model Template •

This template has everything you need set up and configured for you. It will work as-is, or can be adapted to your variable and dialog names. It contains: 1) sample Word and WordPerfect templates (or an Automator form) to demonstrate an implementation of the computation, 2) a component file containing the computation and all supporting dialogs and variables, and 3) instructions for adapting the computation for your use.

(Go to the download page)

 
 

• Contributors •

LegalCS