Remember Selected Records

During assembly, when HotDocs connects to a database, it displays a table of records. Once a user selects a record and moves to another dialog, HotDocs can remember from where in the database table the record was selected so that if the user revisits the table during the interview, the user can see his or her selection.

For HotDocs to operate this way, you must make one of the fields in the database component the key field. A key field contains information that is unique to a record—for example, an invoice number or a customer identification number. Without a key field, HotDocs has no way to remember from where in the table the record was retrieved and therefore, cannot retain this information once the user moves to a new dialog. This may be confusing to a user who reviews a database record selection—even though answers may appear in the assembled document, the interview shows that no record has been selected.

Selecting a key field also makes it easier to reuse an answer file that contains selected database records, for the reasons explained above.

If you are connecting to a database table using a native OLE DB provider, HotDocs recognizes key fields and automatically assigns them in the database component. (You can always choose a different key field, if necessary.) However, HotDocs does not recognize existing key fields when you connect to the database using the OLE DB provider for ODBC, or when your database component is connected to a database view. You must manually identify the key using the Database Editor.

The field you designate as the key field must always have a non-null value. This applies even in cases where you are defining multiple key fields—if you specify multiple key columns (because no single column uniquely identifies each row), then none of the columns you select should be nullable.

To identify a field as a key field

  1. Open the database component for editing. (See Edit a Database Component.) The Database Editor appears.
  2. Click the Field Map tab. The window changes to show a list of database fields and their related template variables.
  3. In the Key column, select the field next to the field you want to designate as the key.

If you think you may need an exact replica of a document assembled from a template that includes a database component, be sure to save a copy of the document. If you try to reassemble the document later, even if you use the same answer file, the document may not come out exactly the same because the information stored in the connected database may have changed.

If no single field in the table or view can uniquely identify a selected record, choose multiple keys, making sure the combination of information in those fields will be unique for every record.