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

FILTER Instruction

The FILTER instruction uses a computation you specify to remove entries from a list of answers generated from a repeated dialog.

The REPEAT instruction is only available when you are creating a computation but you can access the same functionality from the Field Editor when you're adding a repeated region in a template.

You can use an FILTER instruction in a computation to provide the same functionality as the Repetition filter computation property in the field editor when you're modifying a repeated region in a template. The computation you use to filter the list of answers must contain a script that evaluates to true or false. For example, if you had a list of vehicles but you didn't want to include any trucks in the final list your computation might read: VehicleType  !=  "Truck", where VehicleType is a variable on your repeated dialog and "Truck" is one of the options. The != operator means "does not equal" so this filter removes any trucks from the list.

You can also use operators to add multiple filters to your computation. For example, if you had the same list of vehicles and you didn't want to include trucks but you now also wanted only red vehicles in your list. In this case your computation might read: VehicleType  !=  "Truck"  AND  VehicleColor  =  "Red". Here the AND operator allows you to remove all trucks from the list and also to only include red vehicles. You can use as many operators as you need to create a filter computation.

You can only use an FILTER instruction between a REPEAT instruction and an END REPEAT instruction.

Instruction name Model After you drag and drop the model into the script tab:
FILTER FILTER  ⟦COMPUTATION_VAR⟧ Replace ⟦COMPUTATION_VAR⟧ with the name of a computation that contains a script which evaluates to true or false.

Example

In the following example, the script filters out all corporate entities from a list of vendors:

""

REPEAT Vendor Information

FORMAT "A, B, and C"

FILTER No Corporate Vendors

RESULT + Vendor Name

END REPEAT

In the preceding script, No Corporate Vendors is a Computation variable with the following script:

Vendor Type != "Corporation"

First, the empty quotation marks set the value of the repeat to "nothing." HotDocs then repeats the Vendor Information DI dialog. After the user enters all the information, HotDocs processes the responses, filters out all corporate entities, and displays a modified list in the specified format.