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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

RecordFilterDescriptor filter expression help for datetime comparison

Thread ID:

Created:

Updated:

Platform:

Replies:

53351 Dec 12,2006 04:41 PM UTC Dec 13,2006 03:46 PM UTC Windows Forms 3
loading
Tags: Grouping
James Blibo
Asked On December 12, 2006 04:41 PM UTC

I have having a problem adding a date filter to the filter expression. The first filter expression below works. However, when I add a date filter to the expression, I am not getting any results although the data is present. The filter i am having problem with is the [WeekID]=?


filterExpr = "[TitleID]=9100 AND [Length]=30 AND [Rate]=0.0000 AND [RevenueTypeID]=1 AND [InventoryTypeID]=2"


filterExpr = "[TitleID]=9100 AND [Length]=30 AND [Rate]=0.0000 AND [RevenueTypeID]=1 AND [InventoryTypeID]=2 AND [WeekID] = #6/26/2006#"

RecordFilterDescriptor rfd = new RecordFilterDescriptor(filterExpr);
this.gridGroupingControl2.TableDescriptor.RecordFilters.Add(rfd);


In the actual dataset, the field is a sql datetime and the value is shown in the.net dataset visualizer as -> '6/26/2006 12:00:00 AM'

How do I compare datetime values?


Administrator [Syncfusion]
Replied On December 13, 2006 09:56 AM UTC

Hi James,

You can filter the Dates by using the following code snippet. For example, to filter to particular dates please follow the code snippet below.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
this.gridGroupingControl1.TableDescriptor.RecordFilters.Add("Column3",FilterCompareOperator.Equals,"12/13/2006");
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

To Filter dates greater than some specific date, please follow the code snippet below
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
tableCellIdentity.Table.TableDescriptor.RecordFilters.Add("DateTimeColumn",FilterCompareOperator.GreaterThan,"7/25/2006");
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

In some cases, if you want to filter between two dates, then you can use between operator
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
tableCellIdentity.Table.TableDescriptor.RecordFilters.Add(“[Col2] between {7/25/2006,9/20/2007}”);
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan

James Blibo
Replied On December 13, 2006 03:42 PM UTC

This is still not working!

No matter how I enter the enter '6/26/2006', DateTime.Parse('6/26/2006'), or '6/5/2007 12:00:00 AM', the FilterDescriptor is not working.

fc = new FilterCondition(FilterCompareOperator.Equals, "6/5/2007 12:00:00 AM");


fc = new FilterCondition(FilterCompareOperator.Equals, "6/5/2007");


fc = new FilterCondition(FilterCompareOperator.Equals, #6/5/2007#);

In the dataTable itself, the field is a datetime and the value in the visual studio visualizer is shown in the format '6/5/2007 12:00:00 AM'

James Blibo
Replied On December 13, 2006 03:46 PM UTC

Never mind, i made a stupid mistake :(

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

;