IMatrixDataSourceExecutorCache.Execute

Syntax

Execute(Dimensions: IDimSelectionSet): IMatrix;

Parameters

Dimensions. A selection, according to which matrix is calculated.

Description

The Execute method checks if data is available in cache and returns output matrix of cached data.

Comments

Executing this method results in checking if cache contains data corresponding to the specified selection. Missing data is extracted from server and added to cache. The Execute method results in a reference to an output matrix of all data sent to cache. If cache is empty or cannot be updated, the Execute method works as the IMatrixDataSourceExecutor.Execute method.

This method also takes into account specified parameters of calculation of an output matrix.

Example

Executing the example requires a form and buttons Button1 and Button2 on it. The repository contains a cube with the Cube_1 identifier. Dictionaries with the Dim_1 and Dim_2 identifiers are set as dimensions of this cube.

Class TESTForm: Form
    Button1: Button;
    Button2: Button;
    DimSS: IDimSelectionSet;
    MatrCache: IMatrixDataSourceExecutorCache;
    Matr: IMatrix;
    
    Sub TESTFormOnCreate(Sender: Object; Args: IEventArgs);
    Var
        MB: IMetabase;
        CubeInst: ICubeInstance;
        MatrDS: IMatrixDataSource;
        MatrExecutor: IMatrixDataSourceExecutor;
    Begin
        MB := MetabaseClass.Active;
        CubeInst := MB.ItemById("Cube_1").Open(NullAs ICubeInstance;
        MatrDS := CubeInst.Destinations.DefaultDestination As IMatrixDataSource;
        MatrExecutor := MatrDS.CreateExecutor;
        MatrCache := MatrExecutor.CreateCache;
        DimSS := MatrDS.CreateDimSelectionSet;
    End Sub TESTFormOnCreate;

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Begin
        DimSS.FindById("Dim_1")...; //Set selection by dimension Dim_1
        DimSS.FindById("Dim_2")...; //Set selection by dimension Dim_2
        Matr := MatrCache.Execute(DimSS);
    End Sub Button1OnClick;

    Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
    Begin
        If MatrCache <> Null Then
            MatrCache.Flush;
        End If;
    End Sub Button2OnClick;

End Class TESTForm;

The specified cube is opened on creating a form. The cube is presented as a multidimensional data source. Cache is created to work with cube data. After the Button1 button is pressed, according to a specified selection, a cube's output matrix is calculated. Cached data is used during calculation. A matrix of cached data is available in the Matr variable. The Button2 button can be used to clear data cache.

See also:

IMatrixDataSourceExecutorCache