Skip to main content

TcxCustomItemDataBinding.Expression Property

Specifies an expression for a specific item.

Declaration

property Expression: string read; write;

Property Value

Type
string

Remarks

A calculated field expression follows Microsoft Excel® formula-compatible syntax, except for references and returned results. An expression calculates independent results row by row based on cell values picked from referred data items in each row. A reference to a data item is its caption enclosed in square brackets (for instance, [Unit Price] refers to the “Unit Price” tree list column). Since data items and rows do not form a contiguous space like spreadsheet cells do, calculated field expressions cannot refer to value ranges and individual values.

A calculated field expression in bound and unbound modes requires an expected result type predefined for the target container control item. Use the ValueType or ValueTypeClass property to set up the result type. In bound mode, the item with a calculated field expression must not be bound to a field in an underlying dataset. Ensure that the item’s DataBinding.FieldName (that is, TcxDBItemDataBinding.FieldName or TcxDBVerticalGridItemDataBinding.FieldName) is set to an empty string. Then, you can:

  • Use the Object Inspector to assign or edit an expression for the item at design time. Type an expression or click the ellipsis button to invoke the “Expression Editor“ dialog.

  • Assign a calculated expression to the Expression property at runtime:

cxTreeList1Total.DataBinding.Expression := '[Unit Price] * [Quantity] - [Discount Amount]';

Note

Not all built-in spreadsheet functions are compatible with calculated field expressions. Use only those functions that the “Expression Editor“ dialog lists.

See Also