This article follows the document SelectVariableExample.docx to describe how to create and use select variables.
The document “SelectVariableExample.docx” has two defined select variables:
- order_date: a date defaulting to 7/7/1997 that defines the order date shown.
- employee_last: text defaulting to Davolio that defines the employee’s last name.
This document describes how those two variables can be manipulated in “SelectVariableExample.docx” to show data in different ways.
The second and third sections below, Date Ranges and Text Selects, outline how select variables are used in AutoTag to show your data in different ways.
The following section, Combining Variables, uses both variables to refine the data even more.
Setting up Select Variables
After connecting to your datasource, you can set up select variables. This is done by going to the AutoTag Manager Tab, then clicking Variables.
In the Define Variables dialog, click Add, and name the variable. Fill in the rest of the information.
For select variables, choose “Select” for type. Under Select Type, choose the format of your variable. Then, type a default.
For the select statement, either write a select statement by hand, or click the wizard button. In the wizard, drag the desired data node into the columns section. This is the data node that you want the variable to represent.
Click OK in the wizard. For a date, your variable setup will look like this:
For any other type of select variable, you will have a similar setup.
Date Variables in AutoTag require one date for their default value. A date range can, however, be set and altered by entering B.I. mode.
Your desired date range can be set in the AutoTag B.I. menu by selecting the dropdown next to the order_date variable, selecting “Filters”, and choosing “Between…”
In the Variable Filter dialog, enter your date range in the boxes provided.
You can also enter a date range by creating a select statement by hand. This select statement shows the date range from 7/1/1997 to 7/31/1997:
filter: dbo.Orders.OrderDate is greater than or equal to '1997-07-01' and dbo.Orders.OrderDate is less than or equal to '1997-07-31'
The first chart in SelectVariableExample.docx has a filter in its select statement so that only the dates defined by the variable “order_date” are shown. In the template, the only date shown is 7/7/1997 because it is the default date. Once the date range is changed in AutoTag, it will show a greater range.
Note: This chart is only filtered by the variable “order_date.” It will show all sales regardless of how other variables are defined.
This table from SelectVariableExample.docx has the same filter as the chart above so that only the dates defined by the variable “order_date” are shown. The table is not filtered by other variables.
The second type of select variable discussed in this document is a select variable of type Text.
SelectVariableExample.docx has a select variable of type Text called “employee_last” with default value Davolio. Different employees can be chosen by entering B.I. Mode. Employee(s) can be chosen by selecting the dropdown next to the employee_last variable, then choosing one of the options in the menu (sort, filters, or select items.)
The filter can also be set by entering a select statement by hand, such as the example shown in the date range example.
This chart from SelectVariableExample.docx has a filter in its select statement so that only the employees defined by the variable “employee_last” are shown. In the template, the only employee shown is Nancy Davolio because she is the default. Once the variable is changed in AutoTag, it will show different data.
Note: This chart is only filtered by the variable “employee_last.” It will show all sales regardless of how other variables are defined.
This table from SelectVariableExample.docx has the same filter as the chart above so that only the employees defined by the variable “employee_last” are shown. The table is not filtered by other variables.
This section shows two of the charts and tables used in the previous examples, but this time they are limited by both select variables: order_date and employee_last.