Back to Devexpress

PivotGridField.OlapExpression Property

wpf-devexpress-dot-xpf-dot-pivotgrid-dot-pivotgridfield-ed8ecec0.md

latest2.9 KB
Original Source

PivotGridField.OlapExpression Property

Gets or sets an expression used to evaluate values for the current unbound field in OLAP. This is a dependency property.

Namespace : DevExpress.Xpf.PivotGrid

Assembly : DevExpress.Xpf.PivotGrid.v25.2.dll

NuGet Package : DevExpress.Wpf.PivotGrid

Declaration

csharp
public string OlapExpression { get; set; }
vb
Public Property OlapExpression As String

Property Value

TypeDescription
String

A string that represents an expression used to evaluate values for the current field in OLAP.

|

Remarks

The code below shows how to set an unbound expression for OLAP:

csharp
using DevExpress.Xpf.PivotGrid;

public MainWindow() {
    // ... 
    var fieldPriceWithDiscount= new PivotGridField() { Caption = "Price with Discount", Area = FieldArea.DataArea }; 

    fieldPriceWithDiscount.OlapExpression = "[Measures].[Internet Standard Product Cost] * 0.9";

    pivotGridControl1.Fields.Add(fieldPriceWithDiscount);
}
vb
Imports DevExpress.Xpf.PivotGrid

Public Sub New()
    ' ... 
    Dim fieldPriceWithDiscount As New PivotGridField() With {.Caption = "Price with Discount", .Area = FieldArea.DataArea}

    fieldPriceWithDiscount.OlapExpression = "[Measures].[Internet Standard Product Cost] * 0.9";

    pivotGridControl1.Fields.Add(fieldPriceWithDiscount)
End Sub

The same unbound expression in XAML:

xaml
<dxpg:x:Name="fieldPriceWithDiscount" Caption="Price with Discount" Area="DataArea" AreaIndex="1"
                         OlapExpression="[Measures].[Internet Standard Product Cost] * 0.9" />

Use the PivotGridField.UnboundExpression property to get or set an unbound expression for regular data sources.

To learn more about unbound fields, see Unbound Fields.

See Also

Bind Pivot Grid Fields to Calculated Expressions

Expression Editor Customization

PivotGridField Class

PivotGridField Members

DevExpress.Xpf.PivotGrid Namespace