Query Templates
Query templates allow you to save a great deal of time if you have particular queries that you run repeatedly. Saved query templates are also listed in the Available Reports area of the Reports window and can be included in generated reports.
If a standard database (*.rsr22) is open when you save a query, it will be stored in the standard templates file (*.xrt22) that is active for your computer. If an enterprise database (SQL Server or Oracle) is open, then the query will be stored within the enterprise database itself.
This topic explains how to manage query templates, including:
- Using a saved template in the Query utility.
- Saving new templates from the Query utility.
- Adding and editing templates via the Query Template window.
Using a Saved Template in the Query Utility
To use a saved template in the Query window, click the Open Saved Query icon.
The Select Existing Query window will display all saved templates for the type of query that was selected in the Query window (items, FMEA causes, etc.). If you want to search for a different record type, use the drop-down list to update the table.
To select a template, double-click the row or select it and click OK.
The settings on the Criteria and Headers Customization tabs of the Query utility will change to reflect the settings used in the saved query.
- If you change the criteria in the Query utility after applying a template, your changes will not affect the saved template. (If you want to update an existing query, use the Edit command in the Templates Manager, or simply delete the old template and replace it with a new one.)
- If the saved template contains criteria for a property that is not enabled for the current data source, that part of the query will be ignored. For example, if the saved template searches for items where the Name contains “bulb” AND the Supplier contains "ACME," but the current data source has the Supplier field disabled, then the query will return items where the name contains "bulb."
Tip: For information on using templates from previous versions of the software, see Templates Manager.
Saving New Templates from the Query Utility
To create a template from within the Query utility, configure all of the desired options on the Criteria and Headers Customization tabs and then click the Save Query icon.
The saved template includes all of the settings specified on the Criteria and Headers Customization tabs. It can then be applied to any data source.
Adding and Editing Templates via the Query Template Window
You can also create or edit query templates from the Templates Manager. To open the manager, choose File > Manage Database > Templates Manager.
Then click either the Add button or the Edit button on the Query Templates tab. The Query Template window works in the same way as the Query utility, with the following exceptions:
- You cannot specify the data source, as the query template can be used with any data source and any interface style. For this reason, all properties are available for use in the Query Template window.
- On the panel on the left side of the window, you must specify a name and, if desired, a description for the query template.
- Instead of a Results tab, the Query Template window has a Preview tab that shows the columns you have selected to include in the results.