Skip to main content
All docs
V23.2

OLAPExpressionBinding Class

Allows you to use an expression to evaluate values for a Pivot Grid’s field in OLAP mode.

Namespace: DevExpress.Web.ASPxPivotGrid

Assembly: DevExpress.Web.ASPxPivotGrid.v23.2.dll

NuGet Package: DevExpress.Web

Declaration

public class OLAPExpressionBinding :
    OLAPExpressionBindingBase

Remarks

Calculated fields display the result of calculated expressions. You can use a formula or an aggregate function as a binding expression for each calculated field. The expression allows you to not only obtain values from a field in the data source, but also specify exactly how to calculate the data (for example, aggregate it).

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

  1. Create an OLAPExpressionBinding instance and pass the expression to 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 the fieldSales field to the MDX expression:

using System;
using DevExpress.XtraPivotGrid;
using DevExpress.Web.ASPxPivotGrid;
//...
PivotGridField fieldSales = new PivotGridField();
fieldSales.Caption = "Cleared Amount";
fieldSales.Area = PivotArea.DataArea;
fieldSales.DataBinding = new OLAPExpressionBinding("[Measures].[Internet Sales Amount] * 0.87");
ASPxPivotGrid1.Fields.Add(fieldSales);

Note

Use ExpressionDataBinding in Server and Optimized modes.

Implements

DevExpress.XtraPivotGrid.IDesignerContextProvider

Inheritance

See Also