Progress® Telerik® Reporting R2 2019

How to: Add Report Parameters

Report parameters typically filter report data that is retrieved from a data source. Filtering data at the data source can improve performance for processing and viewing a report. For the times when you cannot filter data at the source, you can use parameters to filter report data after it is retrieved. You can also sort and group data in a report based on report parameters.

There are several ways to add a Report Parameter:

  • Using the Report.ReportParameters property in the property grid.
  • Select the Report Parameters .. option from the Context Menu of the Report Designer.
  • Right click on the Parameters node of the Report Explorer dialog.
  • From the Configure Data Source Parameters step of the DataSource Components

Add a Report Parameter using Report Designer

  1. Click the ellipses on the Report.ReportParameters property. This invokes the ReportParameter Collection editor.

  2. Click the Add button to create a new parameter.
  3. In Name, type the name of the parameter.
  4. In Text type the text for the parameter to be displayed in the report viewer as prompt to the end user. If not set, the Name of the parameter will be used instead.
  5. In Type, select the data type for the parameter value. By default String type is selected.
  6. You can leave the Value property blank, enter a literal value or click the ellipses to invoke the Expression Edit Dialog.

  7. If the parameter can contain a blank value, set AllowBlank accordingly.
  8. If the parameter can contain a null value, set AllowNull accordingly.
  9. To allow a user to select more than one value for the parameter, set MultiValue accordingly.
  10. To allow a user to select or change a parameter value, set Visible to True.

Add a Report Parameter programmatically

Telerik.Reporting.ReportParameter reportParameter1 = new Telerik.Reporting.ReportParameter();
reportParameter1.Name = "Parameter1";
reportParameter1.Text = "Enter Value for Parameter1";
reportParameter1.Type = Telerik.Reporting.ReportParameterType.Integer;
reportParameter1.AllowBlank = false;
reportParameter1.AllowNull = false;
reportParameter1.Value = "=10";
reportParameter1.Visible = true;

Defining AvailableValues for ReportParameter’s UI using Report Designer

  1. Expand the AvailableValues property of the report parameter and fill the following settings to determine the values the end user can choose from.
    • Set the DataSource property to specify data source from which the available values of the editor will be loaded. The same object types used as data source for the report can be used as data source for the report parameters. If no DataSource is specified, available values are not loaded.
    • In the ValueMember property choose a column from the data source from which the editor to load the values.
    • In the DisplayMember property choose a column from the data source from which the editor to draw the value labels.
    • In the Filters you can limit the number of records in the available values based on specified filter rules. If the conditions of the rules are met the record is included. Filters are defined using the Edit Filter Dialog.
    • Sorting can be performed on the available values through the Sorting property. Sorting controls the order of the items provided to the user to choose from. Sorting is defined using the Edit Sorting Dialog.

Defining AvailableValues for ReportParameter’s UI programmatically

reportParameter1.AvailableValues.DataSource = objectDataSource1;
reportParameter1.AvailableValues.ValueMember = "= Fields.EmployeeID";
reportParameter1.AvailableValues.DisplayMember = "= Fields.FirstName";
Telerik.Reporting.Filter filter1 = new Telerik.Reporting.Filter();
filter1.Expression = "=Fields.ProductCategory";
filter1.Operator = Telerik.Reporting.FilterOperator.Equal;
filter1.Value = "=Parameters.ProductCategory";
reportParameter1.AvailableValues.Filters.AddRange(new Telerik.Reporting.Filter[] { filter1 });
Telerik.Reporting.Sorting sorting1 = new Telerik.Reporting.Sorting();
sorting1.Expression = "=Fields.ProductSubcategory";
sorting1.Direction = Telerik.Reporting.SortDirection.Asc;
reportParameter1.AvailableValues.Sortings.AddRange(new Telerik.Reporting.Sorting[] { sorting1 });
In this article
Not finding the help you need?