Create an Answer Mapping

Creating an answer mapping has the following prerequisites:

Before following the instructions below you should create your answer mapping database. Example steps for setting up a database using MS SQL Server can be seen here.

Part 1: Answer Mapping Integration

There are two ways to integrate Answer Mapping with a HotDocs interview: Answer Source and Event-driven integration.

Answer Source

Displays a link on a template dialog. On clicking the link, the user sees a pop-up window from which they select answers. This is similar to the Answer Source in HotDocs desktop interviews.

To add an Answer Source Integration

  1. Open HotDocs Developer and select the template in the HotDocs Library that requires an answer mapping. Edit the component file.
  2. Edit the dialog on which the Answer Mapping will appear. Create a new Dialog Element.
  3. In the Dialog Element Editor, select the Web Link style.
  4. In the URL field, enter the following URL (with the *placeholders* filled in, see bullet list below) to create the answer source link : ../AnswerSource?mappingname=*Mapping Name*&datasource=*Data Source Name*&command=*Command Name*&multiselect=*true or false*.

In this URL:

  1. Navigate to the Options pane and check the Display In Server Interviews option.
  2. Save the changes to the Dialog Element and close the component file.
  3. Upload this template to Workspace.

Please continue to Part 2: Create an Answer Mapping XML File.

Event-driven

When using an Event-driven integration, Workspace configures specific queries to run when certain events occur during the interview. These events can occur when the interview starts, on navigating to a dialog, on navigating away from a dialog, or when the interview ends.

To add an Event-driven Integration

  1. Open HotDocs Developer and select the template in the HotDocs Library that requires an answer mapping. Edit the component file.
  2. Create a new text variable with the name Workspace_Mapping.
  3. In the custom interview component script, add the instruction SET Workspace_Mapping TO "dialogname=* &mappingname=* &datasource=* &command=* &EventMask=*", where:

The template developer can also assign multiple commands per dialog / interview by setting the control variable using repeat indices, i.e.

SET Workspace_Mapping[0] TO "dialogname=* &mappingname=* &datasource=* &command=* &EventMask=*"

SET Workspace_Mapping[1] TO "dialogname=* &mappingname=* &datasource=* &command=* &EventMask=*"

SET Workspace_Mapping[2] TO "dialogname=* &mappingname=* &datasource=* &command=* &EventMask=*"

Part 2: Create an Answer Mapping XML File

Now, you must create a new Answer Mapping XML file using the Answer Mapping XML. This file specifies:

You can use this table to replace the red placeholders in the example XML below (using an SQL database):

Placeholder Replace with Example
NAME The name of your database employee_db
USER The user name you use to access your database software on the server sa
PASSWORD The password you use to access your database software on the server w0rkspac3
MACHINE The name of your server machine followed by a backslash and your database program MACHINENAME\SQLEXPRESS
COMMAND The command name you used in your template EmployeeSelect
TABLE The name of your table in your database Employee Details
COLUMN Start with the name of the first column in your table and continue until all columns have been listed Employee Number
VARIABLE The name of the variable in your template that you want to map this column to employee_number_n
TYPE The type of variable you are mapping to 2
PROMPT The column heading your want to display in the interview Employee Number

<?xml version="1.0" encoding="utf-8" ?>

<MappingData>  

<DataSource ID="1" Name="NAME" Type="SQL">

<ConnectionString>provider=SQLNCLI10;user id=USER;password=PASSWORD;data source=MACHINE;initial catalog=NAME</ConnectionString>

<Command ID="1" Name="COMMAND" Type="AnswerSource">

<Query Type="Table">TABLE</Query>

<Filter></Filter>

<Mapping>

<Item FieldName="COLUMN" AnsName="VARIABLE" AnsType="TYPE" PrimaryKey="false" Display="true" Prompt="PROMPT"></Item>

<Item FieldName="COLUMN" AnsName="VARIABLE" AnsType="TYPE" PrimaryKey="false" Display="true" Prompt="PROMPT"></Item>

<!--repeat for all columns in your table-->

</Mapping>

</Command>

</DataSource>

</MappingData>

Once you have completed the XML file, you must save it by calling the Mapping Name you used in part 1.

Part 3: Add a Mapping in Workspace

  1. Login to Workspace as a template administrator. Navigate to the Mappings section.
  2. Click Create Mapping.
  3. At the Mapping Details page you can enter the following information:
  4. Click Save. The new answer mapping will appear in the answer mappings list on the Mappings page.