![]() | Type | Description | ||
| String | A formal expression that indicates the formula being used in formatting. For instance, "%0+%1>%2", highlights the cells or the items, when the sum between first two columns is greater than the value in the third column |
The expression may be a combination of variables, constants, strings, dates and operators. A string is delimited by ", ` or ' characters, and inside they can have the starting character preceded by \ character, ie "\"This is a quote\"". A date is delimited by two # characters, ie #1/31/2001 10:00# means the January 31th, 2001, 10:00 AM.
The supported binary arithmetic operators are:
The supported unary boolean operators are:
The supported binary boolean operators are:
The supported binary boolean operators, all these with the same priority 0, are :
Obviously, the priority of the operations inside the expression is determined by ( ) parenthesis and the priority for each operator.
The supported conversion unary operators are:
Here's few predefined types:
Other known operators for numbers are:
Other known operators for strings are:
Other known operators for dates are:
The expression supports also immediate if ( similar with iif in visual basic, or ? : in C++ ) ie cond ? value_true : value_false, which means that once that cond is true the value_true is used, else the value_false is used. Also, it supports variables, up to 10 from 0 to 9. For instance, 0:="Abc" means that in the variable 0 is "Abc", and =:0 means retrieves the value of the variable 0. For instance, the "len(%0) ? ( 0:=(%1+%2) ? currency(=:0) else `` ) : ``" gets the sum between second and third column in currency format if it is not zero, and only if the first column is not empty. As you can see you can use the variables to avoid computing several times the same thing ( in this case the sum %1 and %2 .
Samples:
The conditional format feature may change the cells and items as follows:
The following VB samples bolds all items when the sum between first two columns is greater than 0:
List1.ConditionalFormats.Add("%0+%1>0").Bold = True
The following C++ sample bolds all items when the sum between first two columns is greater than 0:
COleVariant vtEmpty; m_List.GetConditionalFormats().Add( "%0+%1>0", vtEmpty ).SetBold( TRUE );
The following VB.NET sample bolds all items when the sum between first two columns is greater than 0:
AxList1.ConditionalFormats.Add("%0+%1>0").Bold = True The following C# sample bolds all items when the sum between first two columns is greater than 0:
axList1.ConditionalFormats.Add("%0+%1>0", null).Bold = true The following VFP sample bolds all items when the sum between first two columns is greater than 0:
thisform.List1.ConditionalFormats.Add("%0+%1>0").Bold = .t.