Skip to main content Skip to footer

How to Add Runtime Filtering to Your .NET Report Application

Hey everyone! Today we’ll be going over a quick example of how to add runtime filtering to your report using the Apply Parameters feature in ActiveReports 17.1. As you might guess from the name “Apply Parameters”, this action will set parameters for the report when something is clicked. In our example, this will be a textbox.

For this guide, we’re going to start with a report that already has parameters set up to be concise. If you’d like to follow along, you can download the version we’ll be starting with, the completed version, and the data source we’re using.

Note: You will need to adjust the path to the data source to match its location on your system if you use our sample.

If you’d like to learn more about creating parameters, we recommend checking out this blog as well: How to Add a Parameter to your Report | ActiveReports

Ready to Get Started? Download ActiveReports.NET Today!

When completed, our example will look something like this where clicking on each textbox will toggle its corresponding category, adding or removing that category from the displayed data:

.NET Report Filtering

Create Something for Users to Click on to Apply Parameters

In the example, we will create a table of checkboxes/textboxes that automatically populates a row for each parameter in the parameters data set.

1. Add a table with two columns.

2. Add a checkbox to one column and a textbox to the other.

3. Set the textbox to the value of your parameters field.

  • In the example, it will be: =Fields!CategoryName.Value

4. Link the checkbox to the state of your parameters.

  • In the example, we can use: =IndexOf(Parameters!Categories.Value, Fields!CategoryName.Value)>-1

If you’re following along with the example, it should look something like this:

.NET Report Filtering

Add the Apply Parameters Action

In the example, we’ll add the Apply Parameters action to the textbox in our table. Soon, it will be possible to add an action directly to a checkbox control which will circumvent the need to have a textbox at all, but for now, we’ll be doing it this way.

1. Select the textbox.

2. In the Misc section of the properties panel, find “Action” and click the “…” button to open the action dialog.

.NET Report Filtering

3. Under “Action Type” select “Apply Parameters”

.NET Report Filtering

4. In the “Parameters” table, set the name to the parameter you want to adjust with the action.

  • In the example, we’ll set the “Type” to “Toggle” since we are using a multi-value parameter
  • Then we’ll set the value to =Fields!CategoryName.Value to grab the same parameters that we’re setting to our textbox

.NET Report Filtering

That should be it! If you follow the example, it should function the same as it does on our end. If you have any questions, please feel free to ask in the comments below, and we will be happy to address them!

Ready to Get Started? Download ActiveReports.NET Today!

Tags:

comments powered by Disqus