Reports frequently require a certain degree of parameterizing so that the user can filter the displayed information, thus restricting analysis to subsets of information.
In this section we describe how to add to the report a parameter which will enable the displaying of data for only one salesperson, without it affecting the structure of the report.
Creating a new parameter.
- In the Data Explorer panel, right-click on the Report Parameters element.
- Create a new parameter
This action opens the parameter editor. - Indicate the following data for the parameter:
Name:
The name of the parameter
In our case Vendedor ( Salesperson)Data type:
Parameter data type
In our case StringDisplay Type:
Way to display data.
In our case List Box - Selecting the way in which data are displayed as List Box displays a set of additional options typical of this form of viewing.
The drop-down list (list box) may contain static or dynamic options.
The static case lets the designer of the report indicate in a static way the list of elements to be included on the list.
The dynamic case lets the designer define a query to load the list with stored data, for instance, in an O3 cube. - Indicate the type of dynamic list
This type of parameter requires the existence of Data Set from which the values to load the list will be taken. - Using the Create New... button, create a new Data Set as indicated below:
Name
Vendedores
Data Source
O3 Local MDX
Data Set Type
O3 Data Set
- Enter the following MDX query in the Data Set Specification
SELECT {[Vendedores].[Vendedor].members} ON COLUMNS FROM [Vinos]
For more details on the definition of a Data Set refer to the section Specifying the data to use
- Confirm changes to the Data Set editor
- Complete the parameter data with the new information.
Data Set:
Data Set to which the parameter is associated
In our case we will use the Data Set VendedoresSelect value column:
Data Set field that contains the key to the parameter.
In our case we will use unique_nameSelect display text:
Data Set field containing the parameter label to show the user.
In our case it will be label - Finally, the editor should show the following.
- Press the OK button to conclude the creation of the Parameter, which will appear in the Data Explorer window under Report Parameters.
At this stage we may run the report to see a window displayed, where the parameter value is requested from a list of options obtained from the O3 Cube.
Using the Parameter in the query
Once the parameter is defined, it is necessary to use it in the query to filter it and return only the Salesperson selected by the user.
In order to do so, we will modify the Data Set defined in the section Specifying the data to use.
- From the Data Explorer, double-click the Data Set Ventas MDX.
- Modify the MDX query so that it contains the following.
Please note the query mark in the section corresponding to the rows. This mark indicates the place where the parameter value will be substituted when the query is run.
SELECT {[Measures].[Litros Vendidos], [Measures].[Venta Neta]} ON COLUMNS ,CROSSJOIN({[Vendedores].[Vendedor].?}, {[Vinos].[Vino].members}) ON ROWS FROM [Vinos]
- Select Parameters in the Data Set editor.
- Add a new parameter with the New... button
- Configure the parameter as follows
Name:
Parameter name
In our case VendedorData Type:
Parameter type
In our case it requires no modificationDirection:
Parameter Direction (Input or Output)
In our case we will use inputDefault Value:
Value the parameter will have by default.
In our case N/ALinked To Report Parameter:
Parameter to which it is associated
In our case Vendedor - Finally, we just have to run the report to see how data are filtered to show only the sales for the selected Salesperson.