AmosFiveSix.com

Experience, Knowledge, Creativity

  • Increase font size
  • Default font size
  • Decrease font size
Home Portfolio Portfolio Articles Document Builder for NACS

Document Builder for NACS

E-mail Print PDF

Document Builder I created the Document Builder to automate the process of building the Directory of Colleges and College Stores for the National Association of College Stores. Previously, NACS had outsourced the creation of the directory once a year to a third party, which wasted a lot of time and money with out of the office communications and revision after revision. The new Document Builder allows NACS to create the directory at any time with the press of a button.

The Document Builder is essentially a fancy mail merge tool built with VB.net and SQL Server. It allows you to easily read hierarchical data from a database, format the data exactly as you want it, and output it in a variety of formats.

Query Tree

The directory includes a massive amount of data organized into many different levels. This complex data extraction required a custom tool. Here's the hierarchy for the stores section:

  • Country
    • State
      • City
        • Institution
          • Store
            • Employee

The document builder represents the hierarchy using an XML file. See QueryTree.xml and QueryTree.xsd

Each level in the hierarchy can have hundreds of children below it, and hundreds below it, etc. Making a database call for each entry at each level in the hierarchy would be incredibly inefficient. The Document Builder makes only one database query for each level, retrieving all of the data needed for every entry at that level at one time. (See a sample query statement for the stores.) In this example, only six database calls are made to create a 600+ page document.

The query tree component automatically iterates through all of the items at each level, going up and down the hierarchy to process children as needed. For each record in the queries, a custom object is loaded with the record's data and methods are called to allow the object to process itself. See Store.vb for the code used to process each store record.

See the VB.net code for query tree here: QueryTreeRoot.vb, QueryTreeNode.vb, QueryTreeNodes.vb

StyleWriter

The Document Builder allows you to create output in Adobe InDesign, Microsoft Word, HTML and plain text formats. It does this by providing an abstract StyleWriter object with concrete implementations for each format.

Object Reader

The object reader component is used by the query tree to load each record of data into the entity objects (Store, Employee, etc.) automatically. Those objects don't have to worry about were their data comes from, it's just there when they need it.

Sample output

Document Builder Output

Screen shots from the wizard

Document Builder>/p>

Document Builder

Screen shots from the exception dialog box component

Exception Dialog Box

Exception Dialog Box