IPivot.SetDataSource

Syntax

SetDataSource(Value: IMatrixDataSource; ClearSelection: Boolean);

Parameters

Value. Data matrix.

ClearSelection. Indicates whether selection can be cleared when a new data source is set.

Description

The SetDataSource method sets a data source.

Comments

To determine a data source, based on which a table is created, use the IPivot.DataSource property.

Example

Executing the example requires that the repository contains an express report with the EXPRESS_REPORT identifier and a cube with the CUBE identifier that will be set as a new report data source.

Add links to the Cubes, Express, Matrix, Metabase, Pivot system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    CubeInst: ICubeInstance;
    CubeDest: ICubeInstanceDestination;
    Expr: IEaxAnalyzer;
    Pivot: IPivot;
    DS: IMatrixDataSource;
Begin
    // Get the current repository
    MB := MetabaseClass.Active;
    // Get express report
    MObj := MB.ItemById("EXPRESS_REPORT").Edit;
    // Get cube
    CubeInst := MB.ItemById("CUBE").Open(NullAs ICubeInstance;
    CubeDest := CubeInst.Destinations.DefaultDestination;
    Expr := MObj As IEaxAnalyzer;
    // Set data source
    Pivot := Expr.Pivot;
    DS := Pivot.DataSource;
    Expr.Pivot.SetDataSource(DS, True);
    // Replace data source, based on which table is created
    Expr.Pivot.DataSource := CubeDest As IMatrixDataSource;
    // Save changes
    MObj.Save;  
End Sub UserProc;

After executing the example the data source is changed for the specified slice.

See also:

IPivot