[{"id":"e0909540-8bde-4587-bb4d-02445746db2a","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"464b8e03-462d-4aed-8818-05d32ec3bf00","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"75b66fd4-b740-443d-bc6e-1782048b60a6","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"fd5d021d-0210-4d74-ba42-1a39ef14a385","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"a20f26ac-cd31-4e4d-9454-1e035b0f1587","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"7fce7040-1bb1-4a61-9fb7-2e19d569de50","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"f235557b-9781-471f-bf03-38bae6e3e953","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"c8c7b5d5-f5bd-4b68-a12f-3aae9804a844","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"dde44832-bb5c-45f3-8ebf-3badbc613cd9","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"a0c823ed-e22b-493b-aded-4d201c0fa480","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"2f064d57-b088-4bc5-a628-4e0d7e1a0c65","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"577a09da-dea1-42db-812f-4eeaa9274ece","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"0eb72dd3-8f8f-4039-93a8-500bbde2301e","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"3f2ea860-c764-43d8-ae3f-6e3b0314ce67","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"3604b8ce-1da0-413f-8274-7df0f7173573","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"f290406b-ced1-4c52-abad-979160a79f6b","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"d19bc9cd-ff53-4b0d-ab7e-a68c1497c4c6","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"ac046cee-82b9-4edf-a642-ae6d7cb21ebf","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"81eb70e8-f770-4384-9167-bc7c755ad052","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"1864834b-08ce-43f1-891b-c3cca6e04e95","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"f96cfec1-420c-4ca7-ab0a-cab482731073","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"d0dff477-9f56-483a-a9fc-cab648905b41","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"548568fe-dbd1-4da5-a489-d9b3edf75329","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"27658163-a479-432f-a192-dbed286beb3e","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"793a62d7-460d-4699-9304-edb2941268ac","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"8ddd80d5-886f-41b8-8e3f-f73aa8146c8d","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"43de3664-261b-4cf9-9945-fb519251f4c7","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]},{"id":"94759fce-692f-4779-b5f3-fce5c58f242c","tags":[{"name":"new","color":"#ed7422","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"4d7b6a40-ab32-4c71-a381-58f3ffd2653e"}]},{"id":"2d6ebfad-f7d1-4cc5-8ba1-fdace3472056","tags":[{"name":"upd","color":"#7e678a","productId":"d699a6af-e150-4da3-ab30-25fd97934601","links":null,"id":"fe610228-9cf6-417f-813a-dcbfd25406c3"}]}]
        
(Showing Draft Content)

Parameters usage

After incorporating parameters into a report, as outlined in the "Parameters Designer" page, you can reference these parameter values at various points throughout the report to fulfill your specific requirements. Here, we've compiled a selection of the most commonly encountered scenarios, accompanied by a step-by-step guide on how to implement each one.

Dynamic Data Queries

Web APIs, often used as data sources for reports, typically allow for parameterization. There are numerous methods to deliver parameter values, and we'll discuss the most prevalent ones below.

Path Parameters

Path Parameters are embedded within the API endpoint's path. For instance, the endpoint at https://demodata.mescius.io/northwind/api/v1/Categories/{id}/Products contains the {id} path parameter, which designates the category for which a product list should be retrieved.

Imagine your application needs to allow users to select a product category. The following instructions outline the basic process for accomplishing this.

  1. Incorporate a data source into your report, using the configuration displayed below.

    image

  2. Introduce the Categories dataset, which fetches a list of all categories.

    image

  3. Include the CategoryID parameter with the setup shown below.

    image

  4. Add the Products dataset, which employs the parameter established in Step 3 for the path parameter. On clicking the Validate button, a dialog will prompt for the parameter's value to fetch the field list. Here, you can enter 1.

    image

  5. Incorporate a data region, like a Table, to visualize the Products dataset.

  6. When the Report Viewer component loads the report, it will prompt the user to choose a category and display the products related to the selected category.

    image

Query String Parameters

Query string parameters are located after the ? symbol in the data request URL. APIs that utilize OData often provide the capacity to sort, filter, expand, slice, and select specific fields through these query string parameters. For example:

The following steps illustrate how to create a report that prompts the reader to select a product category, then displays the products associated with the selected category.

  1. Incorporate a data source into your report, using the configuration shown below.

    datasource

  2. Introduce the Categories dataset, which retrieves a list of all categories.

    image

  3. Include the CategoryID parameter with the following setup.

    image

  4. Add the Products dataset, which utilizes the parameter from Step 3 to determine the $filter query parameter's value. When you click the Validate button, a dialog will prompt for the parameter's value to generate the field list. Here, you can input 1.

    image

  5. Integrate a data region, like a Table, to visualize the Products dataset.

  6. When the Report Viewer component loads the report, it will prompt the user to choose a category, then display the related products.

GraphQL Query Arguments

In the case of a GraphQL API, query arguments are typically passed within the body of the POST request. Follow the steps below to build a report that allows the user to select a product category to be displayed:

  1. Incorporate a data source into your report, using the configuration below. Please note, the Content-Type HTTP header is set to application/json, a requirement for GraphQL queries.

    image

  2. Introduce the Categories dataset, which fetches a list of all categories. Please note that the method is POST and the request body employs the JSON format for the query.

    image

  3. Include the CategoryID parameter using the configuration displayed below.

    image

  4. Add the Products dataset, which utilizes the parameter from Step 3 to pass the id parameter into the query, thus returning only the specified category. On clicking the Validate button, a dialog will prompt for the parameter's value to generate the field list. Here, you can enter 1.

    image

  5. Drag and drop the Products dataset into the report body.

  6. When the Report Viewer component loads the report, it will prompt the user to select a category, then display the related products.

HTTP Headers

A common scenario for using dynamic HTTP Headers is to authorize data requests with the current user's credentials. The following steps demonstrate a basic technique to design dynamic HTTP Headers using Bearer Authentication and the Authorization HTTP Header.

  1. Introduce a report parameter with the configuration below. Note that the Hidden flag is activated as we will assign the parameter's value with the application's code, hence, no interactive actions from a report reader are required.

    image

  2. Integrate a data source with the configuration shown below. Note the Authorization HTTP Header which refers to the parameter's value.

    image

  3. Incorporate datasets to read data from one or more endpoints of the Contoso Web API, and add data regions to display the datasets data.

  4. If your application utilizes the Report Viewer component to display the report output, you can apply the technique of setting parameter values to pass the current user's access token as the value of the AccessToken report's parameter, as shown below:

    // This is a pseudo-code that retrieves the access token of the currently logged-in user.
    // The specific implementation depends on the architecture of your application.
    const accessToken = authService.getAccessToken(); 
    // Pass the obtained accessToken as the report's parameter value.
    viewer.open("Products.rdlx-json", {
        ReportParams: [
            {
                Name: "AccessToken",
                Value: [accessToken],
            },
        ],
    });
  5. If your application exports a report via an API call, the code can pass the parameter's value as illustrated below:

    async function exportReport(reportUrl) {
      // This is a pseudo-code that retrieves the access token of the currently logged-in user.
      // The specific implementation depends on the architecture of your application.
      const accessToken = authService.getAccessToken();
      var reportDef = await fetch(reportUrl).then((response) =>
        response.json()
      );
      const report = new GC.ActiveReports.Core.PageReport();
      await report.load(reportDef, reportParameters: [{
            Name: 'AccessToken',
            Value: [accessToken]
        }]);
      const doc = await report.run();
      const result = await GC.ActiveReports.PdfExport.exportDocument(doc, {});
      result.download("access-token.pdf");        
    }

Runtime Filtering

In certain scenarios, changing the value of a parameter triggers a new data request, as its configuration relies on the parameter's value. While this approach reduces the volume of retrieved data through server-side filtering, it does incur additional time in sending the request and handling the response.

In some cases, you may prefer to receive all data at once, applying filters on the client side based on parameter values without necessitating new data requests. This approach can be achieved through the use of data region filters bound to parameter values. The following steps outline how to implement this scenario:

  1. Incorporate a Data Source: Add a data source to your report using the configuration as shown below.

    datasource

  2. Introduce the Categories Dataset: This dataset retrieves a list of all categories.

    image

  3. Include the CategoryID Parameter: Set up the CategoryID parameter as illustrated below.

    image

  4. Add the Products Dataset: This dataset retrieves all products. Note that the list of retrieved fields is restricted by the $select feature of the OData API.

    image

  5. Generate a Table from the Products Dataset: Drag and drop the Products dataset onto the report design surface. This action will automatically create a new table with Product Name and Category Id columns.

  6. Add a Filter to the Table: Select the newly created table and navigate to the Properties tab in the Property panel. Find the Filters property and click the Add button.

    image

  7. Configure the Filter: In the filters editor, add a new item. Select CategoryId on the left side of the = operator and select the CategoryID parameter on the right side.

    image

  8. Preview the Report: You can now preview the report and switch between categories. The table will display products of the selected category without making additional data requests.

Applying Parameters Through Interactive Actions

ActiveReportsJS not only enables setting parameter values through the Parameters panel, but also supports interactive application of parameters. The Apply Parameters interactive action is activated when a user clicks on interactive elements in the report output, allowing for a more dynamic, responsive report interaction.

This approach paves the way for configuring interactive filters that provide a dashboard-like functionality, facilitating a more user-friendly and intuitive data exploration. For a more detailed guide on crafting such reports, refer to our walkthrough, Getting Started with Pageless Reports. This guide will equip you with step-by-step instructions on how to leverage interactive actions in your reports for an enhanced user experience.

Passing data between reports

ActiveReportsJS provides a comprehensive solution for integrating reports within other reports using the Subreport report item. This feature enables the embedding of a linked report's output into the main report. One of the common applications of this feature is in the creation of Master-detail reports, where the main report displays a general overview (master) and the subreports provide more detailed data (detail) for each record.

To facilitate this process, the linked reports can have hidden parameters. These parameters, which receive their values from the main report, allow for the transmission of specific data points to the subreports. This value-passing mechanism is facilitated by the Subreport control properties, which enable you to set the values of these parameters as required.

In a similar manner, parameters values are also passed into a drill-through report. A drill-through report allows users to view additional, related data on-demand from a main report by "drilling through" to the detailed data in a subreport.

For more detailed guidance on implementing drill-through reports, please refer to our walkthrough, Getting Started with Drillthrough Reports. This guide offers step-by-step instructions on this specific reporting type.

Customizing Report Output

Report items expose properties that are evaluated as expressions at runtime. This means that these expressions can include references to parameter values. This feature allows you to tailor the report output based on user preferences.

Consider a scenario where a report has a Theme parameter with two possible values: Dark and Light. You can reference this parameter within the properties of report items, enabling the report reader to switch between themes dynamically.

For example, you could set the Text Color of a textbox to {IIF(@Theme="Dark", "White", "Black")} and the Background Color to {IIF(@Theme="Dark", "Black", "White")}. This will adjust the text and background colors based on the selected theme, providing a more personalized user experience.

Working with Multi-Value Parameters

The Multivalue attribute in parameter properties is used to specify if a parameter can accept multiple values. When this attribute is set, the parameter's value is returned as an Array object in an expression. This array typically needs to be transformed into a different format.

For instance, to convert the Array into a string of values separated by a comma or any other delimiter, you can use the Join function in the format {Join(@parameterName, ",").

If your report necessitates more intricate operations, the Custom Code feature can be utilized. This feature allows you to create a function that takes an Array as an input and returns the desired output. This provides greater flexibility in handling and manipulating multi-value parameters according to your specific requirements.

Implementing Cascading Parameters

Cascading parameters are a configuration setup where the value of one parameter is dependent on the value selected in another parameter. This feature is demonstrated in the Get Started with Fixed Layout Reports walkthrough, where it is used to display an order list for selected customers. The setup for cascading parameters involves the following components:

  • A DataSet that is configured based on the value of the first parameter. For example, the Fixed Layout Report walkthrough uses a data set that filters data using a parameterized OData filter query.

  • A second parameter that retrieves its available values from the data set. When the value of the first parameter changes, the data set is updated, which in turn refreshes the available values for the second parameter. This dynamic interaction allows for a more responsive and intuitive user experience.

Expand to watch using cascading parameters in action