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

GridConditionalFormatDescriptor and comparing datetime field

Thread ID:

Created:

Updated:

Platform:

Replies:

57847 Mar 12,2007 08:53 PM UTC Mar 25,2010 06:19 AM UTC WinForms 7
loading
Tags: Grouping
James Blibo
Asked On March 12, 2007 08:53 PM UTC

I have a GridConditionalFormatDescriptor in a ggc. All my other expression works fine (for example, below.. [SpotStatus] LIKE 'RJ' works fine). However, when I tried to do a datetime comparison, nothing's happening, which suggest that my expression is invalid.

Here's my expression...
([WeekID] = '6/26/2006 12:00:00 AM') OR ([WeekID] = '7/10/2006 12:00:00 AM') OR [SpotStatus] LIKE 'RJ'

WeekID is datetime field in the database where the that looks something like this... 9/25/2006 12:00:00 AM, with the time portion alway being '12:00:00 AM'

Administrator [Syncfusion]
Replied On March 13, 2007 06:09 PM UTC

Hi James,

Please try the attached sample and let me know if this helps.
http://websamples.syncfusion.com/samples/Grid.Windows/GGC_ConditionalFormating_String/main.htm

Best regards,
Haneef

James Blibo
Replied On March 13, 2007 08:49 PM UTC

Sorry.

This sample does not work and is not what I am trying to achieve. I want to set a conditional format and not a record filter. The sample is doing a record filter.

In any event, the sample does not work. I have modified the sample and added comments where the conditional format was failing.

James Blibo
Replied On March 13, 2007 08:50 PM UTC

Forgot to attach the sample. Here it is!

ConditionalFormatIssue.zip

Administrator [Syncfusion]
Replied On March 13, 2007 11:50 PM UTC

Hi James,

Try using the below expression to achieve this.

Descriptor1.Expression = "[DateColumn] match '3/1/2007'";

Expressions can be any well-formed algebraic combination of property (column) names enclosed with brackets ([]), numerical constants and literals, and the algebraic and logical operators listed in the table below.

The computations are performed as listed, with level one operations done first. Alpha constants used with match and like should be enclosed in apostrophes (').

1) *, / : multiplication, division
2) , - : addition, subtraction
3) <, >, =, <=, >=, <>: less than, greater than, equal, less than or equal, greater than or equal, not equal
4) match, like, in, between
5) or, and, or

NOTE: Logical operators return a 1 if the logical expression is True and return a 0 if the logical expression is False.

Given below is some more information on special logical operators:

match - Returns 1 if there is any occurrence of the right-hand argument in the left-hand argument. For example, [CompanyName] match 'RTR' returns 0 for any record whose CompanyName field does not contain RTR anywhere in the string.

like - Checks if the field starts exactly as specified in the right-hand argument. For example, [CompanyName] like 'RTR' returns 1 for any record whose CompanyName field is exactly RTR. You can use an asterisk as a wildcard. [CompanyName] like 'RTR*' returns 1 for any record whose CompanyName field starts with RTR. [CompanyName] like '*RTR' returns 1 for any record whose CompanyName field ends with RTR.

in - Checks if the field value is any of the values listed in the right-hand operand. The collection of items used as the right-hand should be separated by commas and enclosed within braces({}). For example, [code] in {1,10,21} returns 1 for any record whose code field contains 1, 10 or 21. [CompanyName] in {RTR,MAS} returns 1 for any record whose CompanyName field is RTR or MAS. Please note that spaces which, are significant in the list, ie. {RTR,MAS} is not the same as {RTR, MAS}.

between - Checks if a date field value between the two values is listed in the right-hand operand. For example, [date] between {2/25/2004, 3/2/2004} returns 1 for any record whose date field is greater than or equal to 2/25/2004 and less than 3/2/2004. To represent the current date, use the token TODAY. To represent DateTime.MinValue, leave the first argument empty. To represent DateTime.MaxValue, leave the second argument empty.

Best regards,
Haneef

James Blibo
Replied On March 14, 2007 01:34 PM UTC

using 'match' works perfectly.... thanks...

Varun Gupta
Replied On March 22, 2010 12:00 PM UTC

Does functions works in the expressions.

I have a complex logic for the validations and based on that i need to color code the rows.

Please advice.
Regards,
Varun

Rajadurai C [Syncfusion]
Replied On March 25, 2010 06:19 AM UTC

Hi Varun,

Thanks for your interest in Syncfusion Products.

It seems you have posted similar inquiry in an incident(#65945) in Direct Trac which is being followed up. Please followup with that for any further queries regarding this.

Regards,
Rajadurai

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

;