We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

FilterCondition exception

Thread ID:

Created:

Updated:

Platform:

Replies:

41557 Mar 6,2006 04:55 AM UTC Mar 8,2006 06:05 AM UTC WinForms 3
loading
Tags: Grouping
Heath Brand
Asked On March 6, 2006 04:55 AM UTC

Hello, I''m getting an exception (pasted below) when I create filter on grid populated with the results of "select * from products". The filter has one FilterCondition: ProductID equals ''a'' The ProductID column is of type Int32 and it looks like an exception is generated because it can''t convert ''a'' to an Int32. I noticed that the exception is not generated when using an Expression type filter, only with a FilterConditions. Should this exception be handled by the Syncfusion libs? Heath System.ArgumentException: Object must be of type Int32. at System.Int32.CompareTo(Object value) at Syncfusion.Grouping.Internals.SortColumnComparer._Compare(Object x, Object y) at Syncfusion.Grouping.FilterCondition.Compare(Object x, Object y) at Syncfusion.Grouping.FilterCondition.CompareRecord(Record record) at Syncfusion.Grouping.RecordFilterDescriptor._CompareRecord(Record record) at Syncfusion.Grouping.RecordFilterDescriptor.CompareRecord(Record record) at Syncfusion.Grouping.RecordFilterDescriptorCollection.CompareRecord(Record record) at Syncfusion.Grouping.Record.MeetsFilterCriteria() at Syncfusion.Grouping.Record.GetCounter() at Syncfusion.Collections.BinaryTree.TreeTableWithCounterEntry.GetCounterTotal() at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal() at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal() at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal() at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal() at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal() at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetCounterTotal() at Syncfusion.Grouping.Internals.ElementTreeTable.get_VisibleCount() at Syncfusion.Grouping.DetailsSection.GetVisibleCount() at Syncfusion.Windows.Forms.Grid.Grouping.GridGroupExtend.OnInitializeVisibleCounters(Group owner, GridGroupOptionsStyleInfo go) at Syncfusion.Windows.Forms.Grid.Grouping.GridChildTable.OnInitializeVisibleCounters() at Syncfusion.Grouping.Group.InitVisibleCounters() at Syncfusion.Grouping.Group.GetVisibleCount() at Syncfusion.Grouping.Element.GetCounter() at Syncfusion.Collections.BinaryTree.TreeTableWithCounterEntry.GetCounterTotal() at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetCounterTotal() at Syncfusion.Grouping.Internals.ElementTreeTable.get_VisibleCount() at Syncfusion.Grouping.Table.GetVisibleCount() at Syncfusion.Grouping.Element.GetCounter() at Syncfusion.Grouping.RuntimeElementsInTableCollection.get_Count()

stanleyj [Syncfusion]
Replied On March 7, 2006 02:28 PM UTC

Hi Heath, Sorry for the delay. I tried to reproduce in 4.1.0.50, but could not, below are my code snippets. DataTable dt = new DataTable("Table"); for(int i = 0; i < 10; i++) dt.Columns.Add(new DataColumn(string.Format("Col{0}", i+1), typeof(Int32))); Random r = new Random(1); for(int i = 0; i < 10; ++i) { DataRow dr = dt.NewRow(); for(int j = 0; j < 10; j++) { dr[j] = r.Next(10); } dt.Rows.Add(dr); } this.gridGroupingControl1.DataSource = dt; this.gridGroupingControl1.TopLevelGroupOptions.ShowFilterBar = true; this.gridGroupingControl1.TableDescriptor.Columns["Col1"].AllowFilter = true; this.gridGroupingControl1.TableDescriptor.RecordFilters.Add("[Col1] equal a"); Also refer this link, it might help. http://www.syncfusion.com/library/default.aspx?url=groupingbase/algebrasupportedinexpressionsfilters.html Let us know if you still find issues. Best regards, Stanley

Heath Brand
Replied On March 7, 2006 05:52 PM UTC

Hi Stanley, What I''m doing is a little different than your example. I''ve attached a sample program that demonstrates the problem. It''s a modified version of the GridGroupingRebind sample that comes with Syncfusion 4.1.0.50. Below is the relevant code that is causing the problem: DataSet ds = queryOleDb("Products", "SELECT * FROM PRODUCTS order by productname"); if( ds != null && ds.Tables.Count>0 ) { BindData(ds); } //add record filter. FilterCondition fc = new FilterCondition(FilterCompareOperator.Equals, "a"); RecordFilterDescriptor rfd = new RecordFilterDescriptor(); rfd.Name = "ProductID"; rfd.Conditions.Add(fc); this.gridGroupingControl1.TableDescriptor.RecordFilters.Add(rfd); It seems to only happen when using FilterConditions. The reason this is a problem for me is because we allow users to create their own filters, and I''d rather not do type checking on the input if the Syncfusion libs already do it. It does seem to work for expression filters. thanks, Heath

GridGroupingRebind.zip

stanleyj [Syncfusion]
Replied On March 8, 2006 06:05 AM UTC

Hi Heath, Thanks for the input. I see no type checking, so better will be an implementation if you do so. I think you can also make use of the expression string as mentioned earlier. We will also solve these issues in future releases. Best regards, Stanley

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;