vcl-dxspreadsheetconditionalformattingrules-dot-tdxspreadsheetconditionalformattingruleexpression.md
Specifies a formula expression required to calculate a cell formatting criterion for Expression and Cell Is rules.
property Expression: string index 0 read; write;
| Type | Description |
|---|---|
| string | Assigned ValueThe required formula expression string.Returned ValueThe formula expression’s source text string or an empty string if a parse error has occurred. |
Use the Expression property to define formatting criteria for a cell range or data item when an Expression or Cell Is conditional formatting rule is applied.
An Expression conditional formatting rule applies appearance settings accessible through the Style property to all cells in the target cell range or data item for which the calculated expression returns TRUE.
A Cell Is conditional formatting rule interprets a formula expression or value assigned to the Expression property differently depending on the rule’s ComparisonOperator property value:
cicoEqual | cicoGreaterThan | cicoLessThan | cicoGreaterThanOrEqual | cicoLessThan | cicoLessThanOrEqual | cicoNotEqualValue Comparison Mode. The rule compares the values of all affected cells to the calculated result of a formula expression assigned to the Expression property. The Expression2 property value is ignored.cicoBetween | cicoNotBetweenRange Comparison Mode. The rule checks if the values of all affected cells are inside or outside a specific range. Expressions assigned to Expression and Expression2 properties define the value range for comparison.
Refer to the TdxSpreadSheetConditionalFormattingRuleCellIsComparisonOperator type description for detailed information on individual comparison modes.
In Spreadsheet and Report Designer controls, formula expressions follow the same syntax as in Microsoft Excel®, and formula operands can refer to individual cells and cell ranges.
In Data Grid, Vertical Grid, and Tree List, you can use the same built-in functions available in Spreadsheet and Report Designer controls. However, formula expressions can refer only to data items[1] rather than individual cells or arbitrary cell ranges.
To refer to a data item in a formula expression, you can use the data item’s caption enclosed in square brackets:
=[Sales]>AVERAGE([Sales],)*1.2
If you use a data-aware grid View, Vertical Grid, or Tree List control, you can also refer to the corresponding dataset field by its name enclosed in curly brackets:
={fieldSales}>AVERAGE({fieldSales},)*1.2
The Expression property’s default value is an empty string.
Footnotes
See Also
TdxSpreadSheetConditionalFormattingRuleExpression.Expression2 Property
TdxSpreadSheetConditionalFormattingRuleExpression Class