Adding query parameters
A query can specify one or more parameters. Parameters enable a query definition to function as a template for multiple query instances. A query that defines parameters is referred to as a parameterized query. An instance of a parameterized query is referred to as a parameterization.
A parameterized query offers the following benefits:
Patterns of interest may be customized from a single generic query. This can significantly reduce the amount of code that needs to be written and maintained.
Parameterizations exist only at runtime. There is no need to maintain a file for each instance.
Parameters can be used throughout the query in which they are defined. For example, you can use them in the definition of inputs, in
find actions, and in user-defined actions. Values do not need to be hardcoded.
You can add zero, one, or more parameters to a query.
For more information about how the use of parameters affect queries, see
Query lifetime.
To add a parameter to a query
1. In the Query Designer Parameters pane, click to add a new parameter. 2. In the Parameters pane, in the Name field, enter an identifier for the parameter.
An identifier can include lowercase a-z, uppercase A-Z, digits, dollar sign, and underscore. An identifier cannot start with a digit and cannot include any other special characters.
3. Select the type of the parameter. A drop down in the Parameters pane provides the list of valid types applicable.
Query Designer displays the new parameter in a row in the
Parameters pane. To modify the parameter, select it and then click the field to edit in the
Parameters pane. To remove the parameter, select it and then click the
Delete icon (
). Also, the new parameter is immediately added to the source code in the
parameters section of the query definition. If you modify the parameter definition in the
Source tab this is reflected in the
Parameters pane in the
Design tab.