ASSEMBLE Instruction
The ASSEMBLE instruction adds a template you specify to the assembly queue.
The ASSEMBLE instruction model is only available in Component Studio when you are creating a computation or directly in a template using the field editor.
Unlike the INSERT instruction, which adds the content of a specified template into the assembled document when HotDocs encounters the instruction, the ASSEMBLE instruction tells HotDocs to wait until it finishes processing the current template to process the specified template.
It is best practice when working with ASSEMBLE instructions to include them in the template and in the interview (if you're using a custom interview). This is because when HotDocs assembles a document, it runs two scripts:
- Template script- the body of the template where HotDocs replaces the answers to produce the assembled document.
- Interview script- the set of instructions that determine which dialogs to include in the interview. If your template uses a custom interview, this is your custom interview computation (e.g., INTERVIEW). Otherwise, the interview script is the same as the template script for a default interview.
Each time HotDocs processes one of these scripts, it first removes 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 the ASSEMBLE instructions in your interview script do not match the instructions in the template script a number of problems arise; for example, templates added to the assembly queue from the template script are removed and not replaced when HotDocs runs the interview script. If you aren't using a custom interview, your template script and interview script are the same so this is not applicable.
Instruction name | Model | After you drag and drop the model into the script tab: |
ASSEMBLE | ASSEMBLE "File name" | Replace "File name" with the template you want HotDocs to add to the assembly queue. |
The ASSEMBLE instruction calls an interview, but sometimes you may not want to display an interview. When working directly in the template you can select the Suppress Interview option in the field editor. If you are using an ASSEMBLE instruction within a computation, you can use the command switch /ni appended to the filename, e.g. ASSEMBLE "CoverLetter.docx /ni"
Example
A template author is creating a template for resumes and they want to check if the template user also wants to assemble a cover letter. In the interview they add a True/False variable called CoverLetterRequired which asks the template user: "Do you also want to create a cover letter?".
In the template, the template author uses the Field Editor to add the following instructions to the template:
[IF CoverLetterRequired]
[ASSEMBLE "CoverLetter.docx"]
[END IF]
The IF instruction first checks if the template user answers "Yes" to the CoverLetterRequired True/False variable. If they have, then the ASSEMBLE instruction adds the template CoverLetter.docx to the assembly queue. The END IF instruction closes the conditional region. Once HotDocs completes the assembly of the resume template, it begins assembling the "CoverLetter.docx".
Troubleshooting
Problem: The template does not produce an interview
Very long file paths can lead to errors generating an interview.
Solution: Shorten the template's filename or path
Ensure that the file path to any templates called by the ASSEMBLE instruction is as concise as possible. Template file names should be less than 100 characters.