Back to Devexpress

OLAPExpressionBinding Class

windowsforms-devexpress-dot-xtrapivotgrid-a1bc8db2.md

latest4.5 KB
Original Source

OLAPExpressionBinding Class

Gets or sets an expression that is used to evaluate values for a Pivot Grid’s field in OLAP mode.

Namespace : DevExpress.XtraPivotGrid

Assembly : DevExpress.XtraPivotGrid.v25.2.dll

NuGet Package : DevExpress.Win.PivotGrid

Declaration

csharp
public class OLAPExpressionBinding :
    OLAPExpressionBindingBase
vb
Public Class OLAPExpressionBinding
    Inherits OLAPExpressionBindingBase

Remarks

Pivot Grid allows you to create calculated fields. They do not obtain their values from fields in the data source. Instead, you specify a binding expression. The expression can be a formula or an aggregate function. You can use OLAPExpressionBinding to create a calculated field in OLAP mode.

Note

Use ExpressionDataBinding for Optimized and Server modes.

Follow the steps below to create a calculated field in OLAP mode:

  1. Create an OLAPExpressionBinding instance and pass the expression in its constructor as a parameter. You can also use the object’s OLAPExpressionBindingBase.Expression property to specify the expression.
  2. Assign the created object to the PivotGridFieldBase.DataBinding property.

The following code snippet shows how to bind measureField to the MDX expression:

cs
PivotGridField measureField = new PivotGridField() { Caption = "Cleared Amount", 
   Area = PivotArea.DataArea };
measureField.DataBinding = new OLAPExpressionBinding("[Measures].[Internet Sales Amount] * 0.87");
measureField.Name = "fieldInternetSalesAmount";
pivotGridControl1.Fields.Add(measureField);
vb
Dim measureField As PivotGridField = New PivotGridField() With {.Caption = "Cleared Amount", .Area = PivotArea.DataArea}
measureField.DataBinding = New OLAPExpressionBinding("[Measures].[Internet Sales Amount] * 0.87")
measureField.Name = "fieldInternetSalesAmount"
pivotGridControl1.Fields.Add(measureField)

View Example

Refer to the following article for more information: Calculated Fields.

Inheritance

Object DataBindingBase OLAPExpressionBindingBase OLAPExpressionBinding

See Also

OLAPExpressionBinding Members

Bind Pivot Grid Fields to Calculated Expressions

Bind Pivot Grid Fields to Data Columns

Bind Pivot Grid Fields to Data Columns

Bind Pivot Grid Fields to Calculated Expressions

Bind Pivot Grid Fields to Window Calculations

DevExpress.XtraPivotGrid Namespace