Back to Devexpress

PivotGridOptionsData.DataFieldUnboundExpressionMode Property

corelibraries-devexpress-dot-xtrapivotgrid-dot-pivotgridoptionsdata-06d67019.md

latest7.2 KB
Original Source

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.v25.2.Core.dll

NuGet Packages : DevExpress.PivotGrid.Core, DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(DataFieldUnboundExpressionMode.Default)]
public DataFieldUnboundExpressionMode DataFieldUnboundExpressionMode { get; set; }
vb
<DefaultValue(DataFieldUnboundExpressionMode.Default)>
Public Property DataFieldUnboundExpressionMode As DataFieldUnboundExpressionMode

Property Value

TypeDefaultDescription
DataFieldUnboundExpressionModeDefault

A DataFieldUnboundExpressionMode enumeration member specifying the calculation mode.

|

Available values:

NameDescription
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 TypePath to DataFieldUnboundExpressionMode
PivotGridControl

.OptionsData .DataFieldUnboundExpressionMode

|

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;

|

Set the DataFieldUnboundExpressionMode property to UnboundExpressionMode.UseSummaryValues and the field’s PivotGridFieldBase.UnboundExpressionMode property to 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.

See Also

Bind Pivot Grid Fields to Calculated Expressions

PivotGridOptionsData Class

PivotGridOptionsData Members

DevExpress.XtraPivotGrid Namespace