Adding unbounded parameters in reports
Parameters bring interactivity to reports. In the last chapter, we had discussed how a new parameter can be added to a dataset through a query. There can be scenarios where we may want to have a parameter that is not linked to the dataset but is needed for the purpose of reporting. These parameters are referred as unbound parameter. In this and the following recipe, we will discuss how to add a parameter and how to use it in the report. The following sections of the recipe should also give you a greater detailed understanding regarding reports.
How to do it…
Unbounded parameters can be added into reports as follows:
- In this recipe, we will add two parameters, one of type Boolean and the other a String type. The following recipe will show how they will be put to use.
- Go to the Parameter node in the report, right-click on Add and select New Parameter.
- On the new parameter set the following properties:
- Previewing the report should show two new parameters in the report dialog, but filling these values will not have any influences as these have not been linked to the report.
How it works…
Parameters are the means to get user inputs into reports. The parameters for an SSRS report can be found under the parameters node in the report.
There are two kinds of parameters here:
System parameter
System parameters are hidden by default and have a default value, which is defined through the expression. For example, the AX_CompanyName
parameter has the following expression filled in by default:
=Microsoft.Dynamics.Framework.Reports. BuiltInMethods.GetUserCompany(Parameters!AX_UserContext.Value)
The system parameters consist of the following:
User-defined parameters
Further there are two types under user-defined parameters, the bounded and unbounded parameter.
Bounded Parameters
Parameters that are connected to a dataset are identified as bounded parameters. If a dataset is linked to a query, then the parameters are automatically created from the fields that are added to the Ranges node in the AOT query.
Unbounded Parameters
These are parameters that are added manually and may or may not be connected to a dataset. These are used for the purpose of formatting or calculating methods.
Parameters and datasource types
As seen in the earlier chapter, AX SSRS supports different types of datasources such as Query, RDP, OLAP, and External Data Sources. The parameters that are defined, depend on the linked datasource. This chapter will describe the query-based parameters.
Query parameters
When a query is added as a dataset, the ranges defined for the query are automatically added to the Parameters node of the dataset and the report. The dataset parameters can be seen under the parameter node in the dataset. Fields cannot be added manually in the dataset parameters. Each parameter in the dataset refers to Report parameter, which can be seen through the Report parameter property:
Tip
If multiple datasets are added and they refer the same type of field as a parameter, for example, ItemId
, then both the dataset parameters are added to the report parameter. This results in a redundant report parameter for the same field type. In this case, delete one of the two report parameters and then modify the dataset pointer to point to the same report parameter.
Dynamic filters
As in line with the legacy system (AX 2009), it is possible to allow more parameters to be added by the user through the query framework. To enable this, set the Dynamic filters property to Yes on the datasource node.
Tip
If you, by mistake, delete the Dynamic parameter from the Report parameter node, then you can retrieve it by right-clicking and selecting Refresh on the dataset.
See also
- The Adding ranges to the report recipe in Chapter 1, Understanding and Creating Simple SSRS Reports.