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

ERASE Instruction

The ERASE instruction deletes answers from the interview for a variable or dialog you specify.

You can use the ERASE instruction in scripts where you are adding new answers to variables (e.g. with a SET instruction) to first clear the existing answers. If you are using a dialog to temporarily store lists of answers, you can use the ERASE instruction to first clear any existing answers from that dialog. For example, you might have two repeated dialogs—one containing plaintiff names and another containing defendant names. If you need to generate a single list of all parties in the case, you can combine the two lists into a single repeated dialog. To do this, you erase any existing values from the combined list before populating it with the names from the plaintiff and defendant dialogs.

Instruction name Model After you drag and drop the model into the script tab:
ERASE ERASE  ⟦VAR,DIALOG⟧ Replace the existing answers with your new answers.

Avoid placing an ERASE instruction for a component within its own dialog script. Doing so causes the variable to show in interview but users cannot enter an answer. 

Example

Using the ERASE instruction in the script keeps the combined list up to date each time the computation script is processed. For example, if the user adds or removes names in the plaintiff or defendant dialogs during the interview, the ERASE instruction will make sure they are properly added or removed when the combined list is regenerated.

The template author creates the following components:

  • Counter (a local Number variable)
  • Combined List (a Repeated Dialog)
  • Plaintiff Information (a Repeated Dialog)
  • Plaintiff Name (a Text variable contained in Plaintiff Information)
  • Defendant Information (a Repeated Dialog)
  • Defendant Name (a Text variable contained in Defendant Information)

The following script demonstrates how to accomplish this:

ERASE Combined List

SET Counter TO 0

REPEAT Plaintiff Information

INCREMENT Counter

SET Combined Name[Counter] TO Plaintiff Name

END REPEAT

REPEAT Defendant Information

INCREMENT Counter

SET Combined Name[Counter] TO Defendant Name

END REPEAT