The textColor
and bgColor
attributes accept the following kinds of values:
The syntax for an expression is as follows:
(CX operator string ? true_condition : false_condition)
The symbol meanings are as follows:
CX
: the column that contains the value to test. For the current column, use CX
; if n is the column to evaluate, use C
n; for example, C2
operator
: One of these operators: EQ
(equal), GT
(greater than), LT
(less than)string
: Value to compare against. A literal, such as (C2 EQ Johnson ? blue : green);
or numeric: (C2 LT 0 ? red : black)
true_condition
: Value for textColor
if condition evaluates to "true"
false_condition
: Value for textColor
if condition evaluates to "false"
If the string in the expression can be interpreted as a number, the comparisons in the expression are interpreted as numeric. Otherwise, the comparison is a string comparison.
This code shows an expression that displays the grid element in blue if the grid element contains the string "Pam"; or black, otherwise:
<cfgridcolumn name = "FirstName" textColor = "(CX EQ Pam ? blue : black)">
This example displays the text in red if the value in column 1 is greater than four; or black, otherwise:
<cfgridcolumn name = "FirstName" textColor = "(C1 GT 4 ? blue : black)">