PivotGridOptionsData.DataFieldUnboundExpressionMode Property
Gets or sets whether unbound expressions for pivot grid’s data fields are calculated based on the data source records or summary values.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.PivotGrid.v24.1.Core.dll
NuGet Packages: DevExpress.PivotGrid.Core, DevExpress.Win.Navigation
Declaration
[PivotAPIMemberCategory(APICategory.NotSupportedInOptimizedMode)]
[PivotAPIMemberCategory(APICategory.RelationalSource)]
[XtraSerializableProperty]
public DataFieldUnboundExpressionMode DataFieldUnboundExpressionMode { get; set; }
Property Value
Type | Description |
---|---|
DataFieldUnboundExpressionMode | A DataFieldUnboundExpressionMode enumeration member specifying the calculation mode. |
Available values:
Name | Description |
---|---|
Default | An unbound expression is calculated against each data source record, and then the resulting values are summarized. |
UseSummaryValues | An unbound expression is calculated against summary values. |
Property Paths
You can access this nested property as listed below:
Object Type | Path to DataFieldUnboundExpressionMode |
---|---|
PivotGridControl |
|
Remarks
The DataFieldUnboundExpressionMode property specifies the calculation mode for evaluating an unbound field’s expression for all fields with the default PivotGridFieldBase.UnboundExpressionMode setting. An expression can be calculated against each data source record, summarizing the resulting values. Another option is to use the field’s summary value in an expression.
Note
The field’s PivotGridFieldBase.UnboundExpressionMode property with a value other than the UnboundExpressionMode.Default has priority over the DataFieldUnboundExpressionMode setting.
An example, which illustrates the use of different modes in real-life scenario, is the Year End bonus and Quantity bonus calculation.
The image below shows the WinForms Pivot Grid with the ‘drill down’ Underlying Data Source form invoked. The ‘Year End Bonus’ and ‘Quantity Bonus’ fields are unbound, have different expressions and calculation modes, as described in the table below.
Tip
If you have the Demo Center installed, review the Unbound Fields demo.
Year End Bonus | Quantity Bonus | |
---|---|---|
Description | The Year-End Bonus is $600 in fourth quarter if that quarter’s sales exceeded $20,000. If the sales were lower than the threshold, the bonus is $400. Sales for a quarter are defined as the sum of Extended Price from all orders – meaning that calculations are based on summary values. | The Quantity Bonus accumulates a 5% bonus on each individual order that exceeded 50 units. In this case, calculations are based on values from underlying data source records, as you can inspect using the Underlying Data Source window. |
Calculation Mode Setting | Set the DataFieldUnboundExpressionMode property to UnboundExpressionMode.UseSummaryValues and the field’s PivotGridFieldBase.UnboundExpressionMode property to UnboundExpressionMode.Default or UnboundExpressionMode.UseSummaryValues; - or leave the DataFieldUnboundExpressionMode property intact (default value is UnboundExpressionMode.Default) and set the field’s PivotGridFieldBase.UnboundExpressionMode property to UnboundExpressionMode.UseSummaryValues; | Set the DataFieldUnboundExpressionMode property to UnboundExpressionMode.UseSummaryValues and the field’s PivotGridFieldBase.UnboundExpressionMode property to UnboundExpressionMode.DataSource; - or leave the DataFieldUnboundExpressionMode property intact (default value is UnboundExpressionMode.Default) and set the field’s PivotGridFieldBase.UnboundExpressionMode property to UnboundExpressionMode.Default or UnboundExpressionMode.DataSource; |
Note
Hidden fields and fields located in the Filter Area return the ‘Error’ value if the DataFieldUnboundExpressionMode property is set to DataFieldUnboundExpressionMode.UseSummaryValues, because summary values for these fields are not calculated.
To specify an unbound expression mode for a single field, use the field’s PivotGridField.UnboundExpressionMode property. For more information, refer to the Unbound Fields document.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DataFieldUnboundExpressionMode 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.