Adding ranges to the report
Ranges are very important and useful while developing an SSRS report in AX 2012 R3. They help to show only limited data, which is filtered based on given ranges, in the report.
The user can filter the data in a report on the basis of the field added as a range. The range must be specified in the query. In this recipe, we will show how we can filter the data and use a query field as a range.
How to do it...
In this recipe, we will add the field under the Ranges node in the query that we made in the previous recipe. By adding the field as a range, you can now filter the data on the basis of VendGroup and show only the limited data in the report.
- Open the PKTVendorDetails query in AOT.
- Drag the VendGroup and Blocked fields to the Ranges node in AOT and save your query.
- In the Visual Studio project, right-click on Datasets and select Refresh.
- Under the parameter node, VendorMaster_DynamicParameter collectively represents any parameter that will be added dynamically through the ranges. This parameter must be set to true to make additional ranges available during runtime. This adds a Select button to the report dialog, which the user can use to specify additional ranges other than what is added.
- Right-click on the VendorMaster auto design and select Preview. The preview should display the range that was added in the query. Click on the Select button and set the VendGroup value to
10
. Click on the OK button, and then select the Report tab, as shown in the following screenshot: - Save your changes and rebuild the report from Solution Explorer. Then, deploy the solution.
How it works…
The report dialog uses the query service UI builder (that we will cover in later chapters) to translate the ranges and to expose additional ranges through the query.
Dynamic parameter: The dynamic parameter unanimously represents all the parameters that are added at runtime. It adds the Select button to the dialog from where the user can invoke an advanced query filter window. From this filter window, more ranges and sorting can be added. The dynamic parameter is available per dataset and can be enabled or disabled by setting up the Dynamic Filters property to True or False.
Note
The Report Wizard in AX 2012 still uses MorphX reports to auto-create reports using the wizard. The auto report option is available on every form that uses a new AX SSRS report.