Task 6: Create a report parameter that prompts for a vendor name
In this procedure, you create a report parameter that prompts the user to select a particular vendor or all vendors for the products for which the quantity in stock matches the user-specified value.
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.
In New Parameter, Selection list values displays options for providing a list of values to the user.
5 Under Selection list values, choose Dynamic.
This option creates a list of values dynamically. BIRT retrieves the values from the data source when the report runs. This technique ensures that the values displayed are always current.
Under Selection list values, Data Set displays Products, which is the only data set created for the report so far.
4 Create a new data set to retrieve the vendor names to display in the list box.
1 Choose Create New, next to the Data set field.
2 In New Data Set, in Data Set Name, type the following name:
Vendors
Choose Next.
3 In Query, type the following query:
select productvendor
from Products
4 Choose Finish to save the data set. Edit Data Set displays the columns 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.
Figure 13‑40 shows the rows returned by the query. Notice that some vendor names are listed multiple times.
Figure 13‑40 Data rows returned by the Vendors data set
6 Choose OK to save the data set.
5 Specify the values to display in the list box.
1 In New Parameter, in Data set, select Vendors, the data set you created in the previous step.
2 In Select value column, select PRODUCTVENDOR.
3 In Select display text, select PRODUCTVENDOR.
6 Specify how the values should be sorted.
1 Under Sort, in Sort by, select PRODUCTVENDOR.
2 In Sort direction, select Ascending.
7 Ensure that Allow Duplicate Values is not selected. 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 13‑41 shows the complete definition of the RP_productvendor report parameter.
Figure 13‑41 Complete definition of the RP_productvendor report parameter
8 Choose OK to save the report parameter.
9 Preview the report. Enter Parameters appears, as shown in
Figure 13‑42. The RP_productvendor parameter appears as a list box with the first value in the list selected by default.
Figure 13‑42 Enter Parameters displaying both report parameters
View the values in the list box. The values are sorted in ascending alphabetical order, and there are no duplicate values.
10 Choose OK. The report output still shows all products because you have not yet bound the report parameters to the Products data set.