ASSEMBLE Instructions Do Not Work Consistently With a Custom Interview

From HotDocs Wiki

Jump to: navigation, search

Problem

When you include ASSEMBLE instructions in a template that uses a custom interview, the templates in those ASSEMBLE instructions may not always be added to the Assembly Queue. Consequently, they may not be assembled when the current assembly ends.

Solution

This problem happens if the ASSEMBLE instructions in your template are not also included in the custom interview script (and vice versa). To understand why this is necessary, you must learn how HotDocs adds the templates it finds in ASSEMBLE instructions to the assembly queue.

With a custom interview, there are two different scripts that HotDocs processes during an assembly:

  • The interview script is your custom interview computation that determines which dialogs to include in the interview.
  • The template script is the body of the template where HotDocs merges the answers to produce the assembled document.


Each time HotDocs processes one of these scripts, it first removes from the Assembly Queue any templates that were added by ASSEMBLE instructions in the current template. Then, as HotDocs encounters each ASSEMBLE instruction, it adds that template to the assembly queue. Thus, if you have an ASSEMBLE instruction in your custom interview script, the template in that instruction will be added to the assembly queue whenever HotDocs processes your interview script.

This behavior can cause a problem if the ASSEMBLE instructions in your interview script do not match the instructions in the template script. For example, if HotDocs adds templates to the assembly queue while processing the interview script, those templates could be removed when HotDocs subsequently processes the template script. Likewise, if your template script adds templates to the assembly queue, they could be removed when the interview script is processed.

To make ASSEMBLE instructions work consistently with a custom interview

  1. In your custom interview computation (e.g., INTERVIEW), add ASSEMBLE instructions for any templates you want to have automatically assembled after HotDocs finishes assembling the current template. As appropriate, include these ASSEMBLE instructions within If instructions so they are only processed under certain conditions.
  2. In the body (text) of the template, include the same ASSEMBLE instructions that you included in your custom interview computation. Also, ensure that the conditions are identical—if you placed the ASSEMBLE instruction inside of an IF instruction in the interview script, use the same IF instruction in the template.