Execute(Selection: IDimSelectionSet; ScenarioDimIndex: Index; EmptyMatrix: Boolean): IVariableStubExecuteResult;
Execute(Selection: Prognoz.Platform.Interop.Dimensions.IDimSelectionSet; ScenarioDimIndex: Index; EmptyMatrix: Boolean): Prognoz.Platform.Interop.Cubes.IVariableStubExecuteResult;
Selection. Source dimension selection, by which data must be loaded.
ScenarioDimIndex. Scenario dictionary index.
EmptyMatrix. Indicates whether results must be loaded to the matrix.
The Execute method loads data from the source.
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 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.
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, -1, False);
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.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Variable: IVariableStub;
Result: IVariableStubExecuteResult;
Mat: IMatrix;
Ite: IMatrixIterator;
Begin
MB := Params.Metabase;
Variable := MB.ItemByIdNamespace["Variable", MB.GetObjectKeyById("Model_Space")].Bind() As IVariableStub;
Result := Variable.Execute(Null, -1, False);
Mat := Result.Matrix;
Ite := Mat.CreateIterator();
Ite.Move(IteratorDirection.itdFirst);
While Ite.Valid Do
System.Diagnostics.Debug.WriteLine(Ite.Value);
Ite.Move(IteratorDirection.itdNext);
End While;
End Sub;
See also: