DB2 graphic  QMF Version 8

Passing data from user input

You might want to create user options for display purposes. For example, you might provide two ways to view a column chart: in terms of sales or in terms of profits. While you could show both in the same chart, you might want to allow your user to isolate the data and look at only one of these options.

To create user options that change a display, you must capture the user's desired choice using an event action. For example, you might create two data symbols: one is a green circle with the word Sales next to it, and the other is a black diamond with the word Profits next to it. In a Text object, you can instruct your user to "Click either Sales or Profits."

Create the global parameter Gshow to store information about the user's choice. Then create the event actions associated with clicking the green circle or the black diamond. The following figure shows how to define one of these event actions in the Set Parameters page of the Object Behavior dialog box.

Figure 37. Setting a global parameter in an event action

Finally, use the global parameter Gshow to specify which version of the column chart is displayed--sales or profit.

To pass the user input stored in Gshow, write an If() expression for the Value property of the VerticalValueBar object in the data template for the chart.

Here is what that property expression might look like:

Value     =If(Gshow="Sales",total_sales,total_profit)

In this expression, total_sales and total_profit are columns returned by the query.

You can also write embedded If() statements to specify multiple conditions beyond the two possibilities in the outer If() statement.


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