Articles in this section
Category / Section

How to Assign Custom Parameter UI Values to Report Parameters in Bold Reports

Published:
Updated:

Bold Reports allows you to pass parameter values from a custom user interface (UI) to the Report Viewer, enabling the generation of dynamic reports. This capability allows you to use a custom parameter UI to your specific requirements and greatly enhances the integration of Bold Reports within your applications.

Hide Toolbar Items

To use the Custom UI, you must hide the existing UI. The following code snippet demonstrates how to hide the existing parameter block from the toolbar.

$(function () {
   $("#viewer").boldReportViewer({
                   reportServiceUrl: "https://demos.boldreports.com/services/api/ReportViewer",
                   reportPath: '~/Resources/docs/sales-order-detail.rdl',
                   toolbarSettings: {
                       items: ej.ReportViewer.ToolbarItems.All & ~ej.ReportViewer.ToolbarItems.Parameters
                   }
   });
});

This configuration ensures that the parameter-related options are not displayed in the report viewer’s toolbar. For further information, refer to the Toolbar Customization Documentation .

Set Parameters on the Client Side

The parameters property accepts a JSON array value as input with parameter details. Set the default value data to the values property and the name of the report parameter to the name property.

The following code example illustrates how to set report parameters in the script.

<script type="text/javascript">
        $(function () {
            $("#viewer").boldReportViewer({
                reportServiceUrl: "/api/ReportViewer",
                reportPath: '~/Resources/docs/sales-order-detail.rdl',
                parameters: [{ name: 'SalesOrderNumber', labels: ['SO50751'], values: ['SO50751'] }]
            });
        });
</script>

Remember: The parameter name is case-sensitive; it should be same as available in the report definition.

Note: In the above example, the parameter value was directly hardcoded into the parameters property. However, you should pass the parameter value dynamically from your Custom Parameter UI.

Please find the JavaScript Bold Reports Report Viewer sample with above changes here.

To assign Report Parameter Values in Other Platforms:

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied