Skip to main content

TcxGridItemDataBinding.Expression Property

Specifies a calculated field expression for the grid View item.

Declaration

property Expression: string read; write;

Property Value

Type
string

Remarks

Use this property to assign a calculated expression to the grid View item at design or runtime. To assign an expression to a grid View item in bound and unbound data access modes, set the ValueType or ValueTypeClass property to the item value type that matches the calculated expression’s result type. 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 directly at runtime:

tvOrdersTotal.DataBinding.Expression := '[Unit Price] * [Quantity] - [Dicount Amount]';

Calculated expressions follow Microsoft Excel formula-compatible syntax, except for the following exceptions:

  • An expression can only refer to an entire grid View item as a value source. Enclose the target grid View item’s caption in square brackets to refer to its values (for instance, [Unit Price] refers to the “Unit Price” column).

  • An expression cannot refer to a range of grid View items, since their underlying data controller items do not form a contiguous space like spreadsheet cells do. A value range operator (that is, a colon) is not available for use in calculated field expressions as a result. If a function can accept a range of values, list all required grid View item references individually.

Note

All data controllers that provide optimized (that is, partial) access to stored data do not support calculated field expressions, since they cannot reference individual values. Therefore, all TcxGridItemDataBinding class descendants that implement grid View item connections to such data controllers always ignore the Expression property value.

See Also