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. Image for the cookie policy date
close icon

GridConditionalFormatDescriptor and comparing datetime field

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'

7 Replies

AD Administrator Syncfusion Team 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


JB James Blibo 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.


JB James Blibo March 13, 2007 08:50 PM UTC

Forgot to attach the sample. Here it is!

ConditionalFormatIssue.zip


AD Administrator Syncfusion Team 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


JB James Blibo March 14, 2007 01:34 PM UTC

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


VG Varun Gupta 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


RC Rajadurai C Syncfusion Team 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

Loader.
Live Chat Icon For mobile
Up arrow icon