IMatrixDataSourceExecutorCache.Execute

Fore Syntax

Execute(Dimensions: IDimSelectionSet): IMatrix;

Fore.NET Syntax

Execute(Dimensions: Prognoz.Platform.Interop.Dimensions.IDimSelectionSet): Prognoz.Platform.Interop.Matrix.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.

Fore 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.

Fore.NET 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.

Imports System;
Imports System.Collections.Generic;
Imports System.ComponentModel;
Imports System.Data;
Imports System.Drawing;
Imports System.Text;
Imports System.Windows.Forms;
Imports Prognoz.Platform.Forms.Net;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Metabase;

Public Partial Class TESTForm: Prognoz.Platform.Forms.Net.ForeNetForm
    DimSS: IDimSelectionSet;
    MatrCache: IMatrixDataSourceExecutorCache;
    Matr: IMatrix;
    
    Public Constructor TESTForm();
    Begin
        InitializeComponent();
    End Constructor;

    Private Sub TESTForm_Load(sender: System.Object; e: System.EventArgs);
    Var
        MB: IMetabase;
        CubeInst: ICubeInstance;
        MatrDS: IMatrixDataSource;
        MatrExecutor: IMatrixDataSourceExecutor;
    Begin
        MB := Self.Metabase;
        CubeInst := MB.ItemById["Cube_1"].Open(NullAs ICubeInstance;
        MatrDS := CubeInst.Destinations.DefaultDestination As IMatrixDataSource;
        MatrExecutor := MatrDS.CreateExecutor(0);
        MatrCache := MatrExecutor.CreateCache();
        DimSS := MatrDS.CreateDimSelectionSet();
    End Sub;

    Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
    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;

    Private Sub button2_Click(sender: System.Object; e: System.EventArgs);
    Begin
        If MatrCache <> Null Then
            MatrCache.Flush();
        End If;
    End Sub;

End Class;

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