Use Same Answer File to Assemble Two Different Documents
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.
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."
When the user assembles a document from the template, the dialog looks something like this:

Then, when the user clicks the Swap Answers button, the dialog changes:
