Selection Parameters


To demonstrate the usage of a select parameters in a document which lists employee info for a specific employee.

Background Information

Sometimes you need to generate a document, but you don’t need the same document for every single row in your database, you only need one row. So you can use filters to filter out a single row. But you don’t want to change the filter every single time you want to generate a similar document. That’s where parameters come in and in this tutorial, we teach you how to make a parameter that lets you select from your employees first names!


Inserting a Tag, Query Tag - Prefetch Data, Parameter Basics, SQL - Part 1: Basic Selection, SQL - Part 4: Filtering with Parameter Values

Starting Template

Start off with a template similar to the one in the picture below. It has the MSSQL datasource loaded into it (see Connecting to your SQL data if you don’t know what this means) as well as a query tag and some out tags (see Query Tag for more information on the Query Tag). It also has some custom styling, but that’s something that Word does with or without AutoTag.


1. Add a Parameter named FirstName

The first step is to add a parameter as you did in Parameter Basics . Open the Parameters window from the AutoTag Manager ribbon, then click Add and name the parameter FirstName. We are using this parameter to select an employee’s first name. Something important to note is that parameters cannot start with numbers, and cannot contain spaces.

Show Me How!

2. Select Type as select

We want to be able to select a row of data using this parameter, so we’re going to select it’s type as select.

Show Me How!

3. Open Wizard and drag in Employees.FirstName

Click the small wizard icon next to the Select text box to open the SQL Wizard. We only need to make a basic selection here, so drag the Employees.FirstName column to the Columns box.

Show Me How!

4. Save Parameters

Show Me How!

5. Open Wizard for Query tag

Select the query tag and open the wizard for it. We are treating the query tag here just like a forEach tag, except we only expect it to return one result. If it returns multiple results, only the first one will be displayed.

Show Me How!

6. Drag in LastName, FirstName, Title and HireDate

We need these four columns to make our document, so drag them into the columns box.

Show Me How!

7. Add a filter where FirstName is equal to $(FirstName)

Now we’ll be adding a filter just like in SQL - Part 4: Filtering with Parameter Values . Add a group, then afilter, then set the node to Employees.FirstName and set the value to the parameter $(FirstName) from the drop-down box.

Show Me How!

8. Close wizard and add out tag data

Close that wizard and select the data for each of the out tags using the usual data tree method. It should be fairly clear where each piece of data belongs, or you could mix it up for fun.

Show Me How!

9. Geterate document and select a name

Generate the document using the usual means – output -> output format. Now for the extra step in document generation: inputting parameter values. You can type in the box like you have before, or you can use the drop down menu to select from a list of values retrieved from the database! The results reflect your choice.

Show Me How!

Quiz Yourself!

How do I select a parameter value from existing data?
Look up the data in your database using other means, then type in the value
Use a select parameter and assign it to the column you want to choose from
Write my own SQL code
You don’t have to worry, AutoTag will get mad if your data isn’t from the database
Can I type any value into a select parameter
Yes, of course. AutoTag will come up with something if there is not data for my value
Yes, but if the parameter is used in a filter, there might not be any results if the value isn’t in the database.
No. If I try, AutoTag corrects me and makes me type a value that is in the database.
No. You are limited to choosing from the values listed


You have completed this tutorial. We recommend taking a look at the Creating a POD tutorial next!