Parameter.MultiValue Property
Specifies whether or not a parameter can have multiple values.
Namespace: DevExpress.XtraReports.Parameters
Assembly: DevExpress.Printing.v18.2.Core.dll
Declaration
[XtraSerializableProperty]
[DefaultValue(false)]
[TypeConverter(typeof(BooleanTypeConverter))]
public virtual bool MultiValue { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Boolean | **false** | true if a parameter can have multiple values; otherwise false. |
Remarks
When the MultiValue property is set to true, the Parameter.Value property contains a list of values whose type is specified by the Parameter.Type property.
This example demonstrates how to create a multi-value parameter and pass it to a report at runtime.
To do this, create an instance of the Parameter class and provide it with a set of lookup values. Set the parameter’s Parameter.MultiValue
property to true, which allows the parameter to have more than one value. After that, the parameter’s values can be used in the report’s filter string.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-assign-multiple-values-to-a-report-parameter-from-a-connected-data-source-t236094
using DevExpress.XtraReports.Parameters;
using DevExpress.XtraReports.UI;
using System;
using System.Windows.Forms;
// ...
namespace MultiValueParametersExample {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e) {
// Create a report instance.
XtraReport1 report = new XtraReport1();
// Create a parameter and specify its name.
Parameter param1 = new Parameter();
param1.Name = "CatID";
// Specify other parameter properties.
param1.Type = typeof(System.Int32);
param1.MultiValue = true;
param1.Description = "Categories: ";
DynamicListLookUpSettings lookupSettings = new DynamicListLookUpSettings();
lookupSettings.DataSource = report.DataSource;
lookupSettings.DataMember = "Categories";
lookupSettings.DisplayMember = "CategoryName";
lookupSettings.ValueMember = "CategoryId";
param1.LookUpSettings = lookupSettings;
param1.Visible = true;
// Add the parameter to the report.
report.Parameters.Add(param1);
// Specify the report's filter string.
report.FilterString = "[CategoryID] In (?CatID)";
// Assign the report to a ReportPrintTool,
ReportPrintTool pt = new ReportPrintTool(report);
pt.ShowPreviewDialog();
}
}
}
When previewing the resulting report, an end-user will be prompted to specify values for the parameter using the drop-down multi-select list as shown in the following image.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the MultiValue property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.