HotDocs Author WorkflowCreate a template Add placeholders Group variables in dialogs Upload a template Create a script

DECREMENT Instruction

The DECREMENT instruction decreases the value of a Number variable you specify by 1.

DECREMENT is often paired with a WHILE Instruction where it is used to decrease a number every time the WHILE instruction is processed until a condition is met. It is also often used with the COUNTER function to reduce the COUNTER's current number of repetitions by 1, this can be useful when you want to use a COUNTER to number a list but that list needs to start at 0 rather than 1.

Instruction name Model After you drag and drop the model into the script tab:
DECREMENT DECREMENT ⟦NUM_VAR⟧ Replace ⟦NUM_VAR⟧ with the Number variable you want HotDocs to decrease by 1.

Example

 A template author is creating a list in a document that needs to start at 0 rather than 1.

  • x-axis - A computation, with the result type set to number, so numbering starts from zero.
  • y-axis - A Number variable for the y-coordinate.
  • Coordinates - A dialog containing the y-axis in its content.

Within the Script tab in the x-axis computation, type the following (result is a local Number variable):

SET result TO COUNTER

DECREMENT result

result

In the template, use the Field Editor to add the following instructions to the template:

[REPEAT Coordinates]

([x-axis], [y-axis])

[END REPEAT]

If the user provided 5, 7, and -5 for the y-axis, the resulting template is as below:

(0, 5)

(1, 7)

(2, -5)