When creating a composite filter descriptor with a value that contains an array of enums, it generates an expression with IN, and an exception is thrown when adding it to the FilterDescriptors on a RadGridView control.
Exception Message:
{"The expression contains undefined function call In()."}
The expression value is: ([RandomPropertyName] IN (1,3,9) OR [RandomPropertyName] = 10)
We have recently upgraded from 2015.2.728.40 (where this worked) to the Feb. 2019 version, then today upgraded to the May 2019 version. The issue remains.
The project includes the following Telerik references:
Telerik.WinControls
Telerik.WinControls.GridView
Telerik.WinControls.PdfViewer
Telerik.WinControls.RadDock
Telerik.WinControls.RadMarkupEditor
Telerik.WinControls.UI
Telerik.Windows.Documents.Core
Telerik.Windows.Documents.Fixed
Telerik.Windows.Zip
TelerikCommon
this
.radGridView1.EnableFiltering =
true
;
FilterDescriptor filterDescriptor =
new
FilterDescriptor();
filterDescriptor.Value =
new string[] {
"Sales Representative"
,
"Owner"
,
"Sales Agent"
};
filterDescriptor.Operator = FilterOperator.IsContainedIn;
filterDescriptor.PropertyName =
"ContactTitle"
;
filterDescriptor.IsFilterEditor =
true
;
CompositeFilterDescriptor cfd =
new
CompositeFilterDescriptor();
cfd.LogicalOperator = FilterLogicalOperator.Or;
cfd.FilterDescriptors.Add(filterDescriptor);
cfd.IsFilterEditor =
true
;
this
.radGridView1.FilterDescriptors.Add(cfd);
I have logged it in our feedback portal by making this thread public. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.
I have also updated your Telerik points.
Currently, the possible solution that I can suggest is to add a separate FilterDescriptor for each value in the list:
CompositeFilterDescriptor cfd =
new
CompositeFilterDescriptor();
cfd.LogicalOperator = FilterLogicalOperator.Or;
cfd.IsFilterEditor =
true
;
FilterDescriptor filterDescriptor =
new
FilterDescriptor();
filterDescriptor.Value =
"Sales Representative"
;
filterDescriptor.Operator = FilterOperator.IsEqualTo;
filterDescriptor.PropertyName =
"ContactTitle"
;
cfd.FilterDescriptors.Add(filterDescriptor);
filterDescriptor =
new
FilterDescriptor();
filterDescriptor.Value =
"Owner"
;
filterDescriptor.Operator = FilterOperator.IsEqualTo;
filterDescriptor.PropertyName =
"ContactTitle"
;
filterDescriptor.IsFilterEditor =
true
;
cfd.FilterDescriptors.Add(filterDescriptor);
filterDescriptor =
new
FilterDescriptor();
filterDescriptor.Value =
"Sales Agent"
;
filterDescriptor.Operator = FilterOperator.IsEqualTo;
filterDescriptor.PropertyName =
"ContactTitle"
;
filterDescriptor.IsFilterEditor =
true
;
cfd.FilterDescriptors.Add(filterDescriptor);
this
.radGridView1.FilterDescriptors.Add(cfd);
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
filterDescriptor2.Value = new string[] { "Sales Representative", "Sales Person", "Sales Floor Rep" }; filterDescriptor2.Operator = FilterOperator.IsContainedIn;
FilterDescriptor filterDescriptor =
new
FilterDescriptor();
filterDescriptor.PropertyName =
"ContactTitle"
;
filterDescriptor.Value =
"Sales Representative"
;
filterDescriptor.Operator = FilterOperator.IsEqualTo;
FilterDescriptor filterDescriptor2 =
new
FilterDescriptor();
filterDescriptor2.PropertyName =
"ContactTitle"
;
filterDescriptor2.Value =
"Owner"
;
filterDescriptor2.Operator = FilterOperator.IsEqualTo;
CompositeFilterDescriptor cfd =
new
CompositeFilterDescriptor();
cfd.LogicalOperator = FilterLogicalOperator.Or;
cfd.FilterDescriptors.Add(filterDescriptor);
cfd.FilterDescriptors.Add(filterDescriptor2);
cfd.IsFilterEditor =
true
;
this
.radGridView1.FilterDescriptors.Add(cfd);
this
.radGridView1.MasterTemplate.ExcelFilteredColumns.Add(
this
.radGridView1.Columns[
"ContactTitle"
]);