Use Same Answer File to Assemble Two Different Documents

From HotDocs Wiki

Jump to: navigation, search

Sometimes, you may want to assemble two separate documents using the same answer file, but with answers in different places in the document. For example, if you have a power of attorney template that contains separate variables for husband and wife, you can produce a separate document for each spouse to sign. Where applicable, the names can be switched in the document depending on who will sign.

You can create a Computation variable to "swap" answers so that you can use the same answer file to assemble two separate documents, each containing different answers. Then, using a script link dialog element, you can add a button to a dialog to run the computation.


In this example, the computation swaps the answers in the Client Name and Spouse Name variables. At the same time, it also switches the answer for the Client Gender variable. After the computation is created, it is added to a dialog using a script link dialog element and run when the user clicks the button.

//ASK NONE and ASK ALL keep HotDocs from displaying dialogs that ask
//variables automatically because they weren't asked earlier in the interview.
SET Text Var TO Client Name
SET Client Name TO Spouse Name
SET Spouse Name TO Text Var
IF Client Gender = "Male"
  SET Client Gender TO "Female"
  SET Client Gender TO "Male"
Variable Name Description
Client Name A Text variable. In this example, it is the client's name.
Spouse Name A Text variable. In this example, it is the name of the client's spouse.
Client Gender A Multiple Choice variable with two options: Male and Female.
Text Var A temporary Text variable.

The dialog in the example above contains three variables: Client Name, Client Gender, and Spouse Name. Assuming these variables are asked in other dialogs already, it isn't necessary to include them in this dialog, but they are included so the user can see that the values actually do get swapped. However, the user should not be allowed to edit the answers in more than one dialog in the interview, so these three variables should be grayed in the dialog script (using the GRAY instruction).

To add a button to the dialog to run the computation to swap answers, create a script link dialog element. (See the HotDocs Help for information on doing this.) You may also want to include dialog element text to explain why the user should press the button, such as "You may want to save your answers before and after you 'swap' answers so you can keep a separate file for each spouse."