PivotGridFieldBase.ExpressionFieldName Property
Gets the field’s name in unbound expressions.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.PivotGrid.v24.1.Core.dll
NuGet Packages: DevExpress.PivotGrid.Core, DevExpress.Win.Navigation
Declaration
Property Value
Type | Description |
---|---|
String | A String representing the field’s name in unbound expressions. |
Remarks
Note
This member is not supported in Optimized, OLAP, and Server modes. Use ExpressionDataBinding/OlAPExpressionBinding instead.
The examples below show how to create unbound fields in code and supply them with data using expressions. Note that the ExpressionFieldName property is utilized to use other fields within an expression.
Example 1
The following code snippet demonstrates how to create an unbound field in code and supply this field with data using the PivotGridField.UnboundExpression property. In this example, full names are generated based on the first and last names stored in the underlying data source.
using DevExpress.XtraPivotGrid; public Form1() { // ... PivotGridField fieldFullName = new PivotGridField() { Caption = "Full Name", Area = PivotArea.RowArea }; fieldFullName.UnboundFieldName = "fieldFullName"; fieldFullName.UnboundType = DevExpress.Data.UnboundColumnType.String; fieldFullName.UnboundExpression = "[" + fieldFirstName1.ExpressionFieldName + "]" + "+" + "' '" + "+" + "[" + fieldLastName1.ExpressionFieldName + "]"; pivotGridControl1.Fields.Add(fieldFullName); }
Example 2
The following code snippet demonstrates how to create an unbound field in code and use the PivotGridField.UnboundExpression property to supply data. In this example, extended price values are calculated as follows:
[Quantity] * [UnitPrice] * (1 - [Discount]).
Pivot Grid field names are obtained using the
PivotGridFieldBase.ExpressionFieldName
property.PivotGridField fieldExtendedPrice = new PivotGridField() { Caption = "Extended Price", Area = PivotArea.DataArea }; fieldExtendedPrice.UnboundFieldName = "fieldExtendedPrice"; fieldExtendedPrice.UnboundType = DevExpress.Data.UnboundColumnType.Decimal; fieldExtendedPrice.UnboundExpression = string.Format("[{0}] * [{1}] * (1 - [{2}])", fieldQuantity.ExpressionFieldName, fieldUnitPrice.ExpressionFieldName, fieldDiscount.ExpressionFieldName); pivotGridControl1.Fields.Add(fieldExtendedPrice); }
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ExpressionFieldName property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.