Report Filters

To create a Report Filter, click the ‘Edit Filters’ icon on the Reports screen.

Click the ‘Add’ icon at the top-right of the screen. You will now be able to choose your filter in the same way that you do when selecting a Category Object filter.

After choosing the object that you want to filter on, choose the type of filter and the default value and then click ‘Update’ at the bottom-right.

The ‘Cascade Filters’ box at the top-right of the Report Filters screen is ticked by default but can be unticked to prevent cascade filtering from happening.

Click the ‘Save’ icon. The number next to the ‘Edit Filters’ icon will show how many filters you’ve applied to the report.

When you preview or export the Report, all the charts in it will be filtered to show the selected details.

If you change filters on a report that is scheduled - you may receive a message in the bottom right corner. This is to warn you of any schedules are impacted and those you may need to go and change. (See the next section on Report Filters When Scheduled).

 

Report Filters When Scheduled

Sometimes we want to schedule the same report multiple times for different chart filter values.

When you schedule a report with filter values you will see a filter icon appear next to it.

The icon changes colour depending on it’s state.

Amber = The report has report filters, but they have not been overridden for this schedule, so the default values in the report will be used.

Grey = The report has report filters, and the values are overridden for this schedule. Grey means good usually.

Red = the report has bee saved with new filters items (or removed) since this schedule was last updated, action may be required to resolve.

WARNING: Using the report filters and creating multiple schedules is not normally as effective as creating a schedule and bursting it to users with either role, or user restrictions.

Passing Filters Report Filters When Requesting through API

To pass filters to a report via an API request from your application, first when need to create a report with the filters in place as above. Note: You cannot pass a filter unless it is defined as a report filter.

 

I’ve put a couple of pages on the report, the front page gives an example of how to read the passed variables in the report using {{brackets}}. It’s always useful to list the filter values on the reports when filtered in this way.

 The second page has one of our shipped reports on it.  And I’ve added two filters to it as well.

There is more detailed information in the Swagger Hub API documentation, but below we walk through an example returning a pdf report using Postman.

I make a post request to https://mydashboard/pi/api/v2/reports/CHART_ID/pdf

You can find the id of the report on the report screen.

 

For the authorization I can get a token quickly from the app and pass it as a bearer token.

 

 

For authorization I use a bearer token, the Token I pass as below.

 in the request body I pass the filter values, that I want to use. These will correspond to the report filters.

The square brackets [ ] denote that we are passing an array of filters.

{

  "filters": [

    {

      "displayName": "All Audit Users",

      "operandOne": "KEN"

    },

    {

      "displayName": "Audit Type",

      "operandOne": "Total time spent to fetch a chart"

    }

  ]

}

The response body contains the file requested.