Lesson 4: Filter the List of Records

Overview

By default, when HotDocs presents a table of records during the interview, every record in the table is displayed. Depending on the size of the table, this may mean the table with which you are working could make retrieving data from it sluggish.

You can limit the number of records retrieved from a database by creating a filter. A filter compares the value in a database field with another value or with a variable in the template. Only the records that meet the comparison are displayed.

In this template, the INVOICE table contains many records, but you want to generate letters for only those invoices that have not been paid. You can create a filter that displays only the records whose DATE_PAID field is empty.

Start the Tutorial

If you are continuing immediately from Lesson 3, skip the instructions for opening the template and proceed to “Create the Database Filter.”

If you closed the template at the end of Lesson 3, complete the following steps.

To open the Collection Letter template

  1. Open your word processor and click the hotdocs.jpgHotDocs button. The My Test Templates library appears.

    If the My Test Templates library does not appear, choose Open Library (File menu), select the library in the default Libraries folder (for example, My Test Templates.hdl), and click Open.

  2. Select Collection Letter and click edittemplate00046.jpgEdit. The template appears, ready for you to edit.
  3. Click the componentmanager00049.jpgComponent Manager button. The Component Manager window appears.

Create the Database Filter

You must create a filter that displays only the records whose DATE_PAID field is empty. Then, during the interview, users can choose from only unpaid accounts.

To filter the records

  1. With Component Manager displayed, edit the Invoice Data component. The Database Editor appears.
  2. Click the Sort & Filter tab. The window changes to show sorting and filtering options.
    database-editor-invoice-data-1.jpg
  3. Click the Filter by Field drop-down button and select DATE_PAID. The Comparison field becomes active.
    database-editor-invoice-data-2.jpg
  4. Click the Comparison drop-down button and select IS EMPTY.
    database-editor-invoice-data-3.jpg
  5. Click Test. HotDocs displays the test assembly window.
    test-invoice-data-1.jpg

    Notice that seven records are listed. This is because the DATE_PAID field for these seven invoices is empty, meaning these accounts are delinquent on their payments.

  6. Close the test assembly window and click OK at the Database Editor.

Conclusion

You are now finished with this lesson. In it, you learned how to filter a list of records.

If you do not want to go on to Lesson 5 at this time, close Component Manager, and then click the close00131.jpgSave and Close button to close the template. Then exit HotDocs.

If you are continuing on to Lesson 5, click the save00134.jpgSave button to save your work.