IVariableStub.Execute

Syntax

Execute(Selection: IDimSelectionSet; ScenarioDimIndex: Index; EmptyMatrix: Boolean): IVariableStubExecuteResult;

Parameters

Selection. Source dimension selection, by which data must be loaded.

ScenarioDimIndex. Scenario dictionary index.

EmptyMatrix. Indicates whether results must be loaded to the matrix.

Description

The Execute method loads data from the source.

Comments

The method loads data from the source according to the selection specified in the Selection parameter. If this parameter is set to Null, all data is loaded.

If the EmptyMatrix parameter is set to False, the matrix with output data will be available in the IVariableStubExecuteResult.Matrix property. If the EmptyMatrix parameter is set to True, data is not loaded, and the IVariableStubExecuteResult.Matrix property provides the empty matrix, which structure corresponds to the source structure. The obtained matrix can be used to change data. To save changes, use the IVariableStubExecuteResult.Save or IVariableStubExecuteResult.SaveO method.

The ScenarioDimIndex parameter is used if a modeling variable is processed. If the parameter is set to -1, the scenario dictionary is searched automatically in the variable structure.

Example

Executing the example requires that the repository contains a modeling container with the Model_Space identifier. This container includes a variable with the the Variable identifier.

Sub UserProc;
Var
    MB: IMetabase;
    Variable: IVariableStub;
    Result: IVariableStubExecuteResult;
    Mat: IMatrix;
    Ite: IMatrixIterator;
Begin
    MB := MetabaseClass.Active;
    Variable := MB.ItemByIdNamespace("Variable", MB.GetObjectKeyById("Model_Space")).Bind As IVariableStub;
    Result := Variable.Execute(Null, -1False);
    Mat := Result.Matrix;
    Ite := Mat.CreateIterator;
    Ite.Move(IteratorDirection.First);
    While Ite.Valid Do
        Debug.WriteLine(Ite.Value);
        Ite.Move(IteratorDirection.Next);
    End While;
End Sub UserProc;

After executing the example the console window displays data of modeling variable.

See also:

IVariableStub