> Task 6: | Create a report parameter that prompts for a vendor name

> In this procedure, you create a report parameter that asks the user to select a particular vendor or all vendors for the products whose quantity in stock matches the user-specified value. You create a report parameter that appears as a list box, which displays all the vendor names.

> 1 | Choose Layout to resume editing the report.

> 2 | In Data Explorer, right-click Report Parameters, then choose New Parameter.

> 3 | Specify the following property values for the report parameter:

> 1 | In Name, type the following text:

> RP_productvendor

> 2 | In Prompt text, type the following text:

> Display products for this vendor

> 3 | In Data type, select String.

> 4 | In Display type, select List Box.

> On New Parameter, List of value displays options for providing a list of values to the user, as shown in Figure 12‑16. The figure also shows the properties you have specified for the report parameter so far.

> Figure 12-16 | Properties for RP_productvendor report parameter

> 4 | Under List of value, choose Dynamic.

> This option creates a list of values dynamically. BIRT retrieves the values from the data source when the report runs, which ensures that the values displayed are always current.
> Under List of value, Data Set displays Products, which is the only data set created for the report so far.

> 5 | Create a new data set to retrieve the vendor names to display in the list box’s list of values.

> 1 | Choose Create New, next to the Data set field.

> 2 | On New Data Set, in Name, type the following name:

> Vendors
> Choose Next.

> 3 | On Query, type the following query:

> select productvendor
> from Products

> 4 | Choose Finish to save the data set. Edit Data Set displays the columns you specified in the query, and provides options for editing the data set.

> 5 | Choose Preview Results to confirm that the query is valid and that it returns the correct data. You should see the results that appear in Figure 12‑17. Notice that some vendor names are listed multiple times.

> Figure 12-17 | Data rows returned by the Vendors data set

> 6 | Choose OK to save the data set.

> 6 | Specify the values to display in the list box.

> 1 | On New Parameter, in Data set, choose Vendors, the data set you created in the previous step.

> 2 | In Select value column, select PRODUCTVENDOR.

> 3 | In Select display text, select PRODUCTVENDOR.

> 7 | Specify how the values should be sorted.

> 1 | Under Sort, in Sort by, select either Value Column or Display Text. In this tutorial, both provide the same values.

> 2 | In Sort direction, select Ascending.

> 8 | Deselect Allow Duplicate Values. Remember that the Vendors data set returned some vendor names multiple times. Deselecting the Allow Duplicate Values option displays each name once in the list box.

> Figure 12‑18 shows the complete definition of the RP_productvendor report parameter.

> Figure 12-18 | Complete definition of the RP_productvendor report parameter

> 9 | Choose OK to save the report parameter.

> 10 | In the layout editor, choose Preview. Enter Parameters appears, as shown in Figure 12‑19. The RP_productvendor parameter appears as a list box with the first value in the list selected by default.

> Figure 12-19 | Enter Parameters displaying both report parameters

> 11 | View the values in the list box. The values are sorted in ascending alphabetical order, and there are no duplicate values.

> Choose OK. The report output still shows all products because you have not yet bound the report parameters to the Products data set.

(c) Copyright Actuate Corporation 2008