Skip to main content

Designing Ad-hoc Templates (DEPRECATED)

autotag-wiki-logo.pngAutoTag B.I. mode has been DEPRECATED as of version 13.


Ad-hoc (B.I.) templates are standard Windward report/docgen templates with a couple of key additions.


Fundamentally when an ad-hoc template is run, you are running a report, but with variables able to do a bit more than in the regular mode.

The first key difference is the select variable. The select variable is used both to display values to the user, and to set values in the selects when the report is run. You can have variables of types other than the select variable, but only select variables will let you sort, filter, and select from a list.

A select variable can retrieve multiple columns for each row. When more than one column is returned, the first column is the value used in the ad-hoc selects. The other columns are used to display the row's value to the user, but are not used when the ad-hoc select is built when running the report.

Details at Define a select variable

The second key difference is the selects in your template. The selects must include a condition testing for the value in each select ${var}. It doesn't matter what the test in the select is, just that it exists. The system replaces that condition with the one defined in the ad-hoc query. This requirement exists for two reasons. The first is the system need to know where in the select to place the ad-hoc condition and this identifies that location.

The second reason is you do not want every variable applied to every select. You may want a table that shows just the selected products over the selected date range. But you may want a chart next to it to show all products, but restricted to the same date range.

When you create a tag's select using a select variable, if you use the wizard then the following rules will be handled for you. But if you write your own selects, you must follow the below rules:

  1. Every condition using a ${var} must be inside parenthesis such as "(person like ${employee})". When substituting in the ad-hoc variable logic, the system looks for ${var}, then replaces everything inside the parenthesis surrounding it. This allows the system to replace any conditional logic as long as the parenthesis rule is followed.
  2. Ad-hoc sort settings are added by looking for the last occurrence of "order by" and adding asc or desc after each column following it.
  3. When populating the list of values to select from, it adds the vendor specific syntax to return the top 10000 rows. Do not put this restriction in yourself as it will then be added twice which is illegal SQL.

Sample Tag Select


Both ${product} and ${order} are select variables. So this select (in a forEach tag) can have ad-hoc queries where it is returning only the rows that match the value(s) set for both variables. The "equal to" condition can be any condition, because that entire condition will be replaced by the ad-hoc condition.

  • Was this article helpful?