DB2 graphic  QMF Version 8

Using query parameters

Use a query parameter to create a dynamic query. When you include a query parameter, your result set varies, depending on the value of the parameter at runtime.

Dynamic queries are useful when you want to perform one of the following tasks:

Parameters can provide you with many ways to transform your analysis of data into an intuitive visual display for your users.

The most common way to use a query parameter is to have it supply the contents of a filter. For example, WHERE columnname = :Q_filter. Q_filter is then set to different values. Use the Advanced Query wizard or the Query Diagram view to insert query parameters as filters.

You can also use query parameters to supply:

Creating query parameters

You can create a query parameter in the Advanced Query wizard (click the Define Parameter button) or in the Query Diagram view (right-click the Parameters block and click Define Parameter). To create a query parameter, you name it, specify a data type, and in most cases, specify a default value. You then use the parameter in a query.

Note: By using a consistent naming prefix, you can recognize which scene, global, and query parameters you are passing values from and to. For example, you can name query parameters with a Q_, scene parameters with an S_, and global parameters with a G_. Then, to pass a company name from a scene parameter to a query parameter, you might name them S_company and Q_company.

Setting query parameters

To set a query parameter, select the DataTemplaten.QueryParameters object from the Object Inspector list and then edit the value cell for the parameter, as shown below.

Figure 8. Setting a query parameter

You can set a query parameter to a constant, a functional expression, or the value of another parameter, such as a scene or global parameter. For example, to pass information from a scene parameter to a query parameter, you set the value of the query parameter to be equal to that of the scene parameter. For more information on modifying object properties and for information about functional expressions, see Object properties and events.


Go to the previous page Go to the next page

Downloads | Library | Support | Support Policy | Terms of use | Feedback
Copyright IBM Corporation 1982,2004 Copyright IBM Corporation 1982, 2004
timestamp Last updated: March, 2004