ScenarioSubstituteKey: Integer;
ScenarioSubstituteKey: Integer;
The ScenarioSubstituteKey property determines a key of the scenario that is used to extract or save data.
To get the data about whether modeling scenarios are used in the time series database, use the IRubricatorInstance.GetScenarioExists method.
If ScenarioSubstituteKey = -1, the Fact scenario is used to extract or save data.
Executing the example requires a time series database with the TSDB identifier and a modeling scenario with the 12345 key.
Also add links to the Cubes, Dimensions, Matrix, Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Inst: IRubricatorInstance;
Cub: ICubeInstance;
Dest: ICubeInstanceDestination;
Exe: ICubeInstanceDestinationExecutor;
Mat: IMatrix;
FactorIO: IRubricatorFactorIO;
Begin
mb := MetabaseClass.Active;
// Get data of time series database
Inst := mb.ItemById("TSDB").Open(Null) As IRubricatorInstance;
If Inst.GetScenarioExists Then
Cub := Inst As ICubeInstance;
// Get data of time series database as a cube
Dest := Cub.Destinations.DefaultDestination;
// Create a object for working with data
Exe := Dest.CreateExecutor;
FactorIO := Exe As IRubricatorFactorIO;
// Specify key of data extraction scenario
FactorIO.ScenarioSubstituteKey := 12345;
// Prepare and extract data
Exe.PrepareExecute(Null);
Exe.PerformExecute;
// Get results
Mat := Exe.Matrix;
End If;
End Sub UserProc;
After executing the example the Mat variable will contain the matrix with the data of TSDB time series database by the scenario with the 12345 key.
Example execution result: if TSDB time series database uses modeling scenarios, the Mat variable will contain the matrix with TSDB data by the scenario with the 12345 key.
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.Dimensions;
Imports Prognoz.Platform.Interop.Matrix;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Inst: IRubricatorInstance;
Cub: ICubeInstance;
Dest: ICubeInstanceDestination;
Exe: ICubeInstanceDestinationExecutor;
Mat: IMatrix;
FactorIO: IRubricatorFactorIO;
Begin
mb := Params.Metabase;
// Get data of time series database
Inst := mb.ItemById["TSDB"].Open(Null) As IRubricatorInstance;
If Inst.GetScenarioExists() Then
Cub := Inst As ICubeInstance;
// Get data of time series database as a cube
Dest := Cub.Destinations.DefaultDestination;
// Create an object for working with data
Exe := Dest.CreateExecutor();
FactorIO := Exe As IRubricatorFactorIO;
// Specify key of scenario to extract data
FactorIO.ScenarioSubstituteKey := 43973;
// Prepare and extract data
Exe.PrepareExecute(Null);
Exe.PerformExecute(False);
// Get results
Mat := Exe.Matrix;
End If;
End Sub;
See also: