SetCompoundFactorKeys(Value: Array);
SetCompoundFactorKeys(Value: System.Array);
Value. The array of composite keys of time series.
The SetCompoundFactorKeys method determines the composite keys of time series that must be calculated.
The IRubricatorFactorExecutor.SetFactorKeys method sets the keys that must be calculated.
Executing the example requires that the repository contains a time series database with the FC identifier. Add links to the Metabase, Cubes, Matrix, Rds system assemblies.
Sub uProc;
Var
MB: IMetabase;
RubDesc: IMetabaseObjectDescriptor;
RubrIn: IRubricatorInstance;
Cub: ICubeInstance;
Dest: ICubeInstanceDestination;
FactorExec: IRubricatorFactorExecutor;
FactsLookup: IRubricatorFactsLookup;
Key: Array Of Variant;
i: Integer;
Exec: ICubeInstanceDestinationExecutor;
Mat: IMatrix;
Ite: IMatrixIterator;
Begin
MB := MetabaseClass.Active;
RubDesc := MB.ItemById("FC");
RubrIn := RubDesc.Open(Null) As IRubricatorInstance;
Cub := RubrIn As ICubeInstance;
Dest := Cub.Destinations.DefaultDestination;
Exec := Dest.CreateExecutor;
FactorExec := Exec As IRubricatorFactorExecutor;
FactsLookup := RubrIn.CreateFactsLookup;
i := FactsLookup.LookupFactorsC.Length;
Key := New Variant[i];
Key := FactsLookup.LookupFactorsC;
FactorExec.SetCompoundFactorKeys(Key);
FactorExec.ValueKind := MetaAttributeKind.Value;
FactorExec.ValueId := "VL";
FactorExec.UseDwarf := True;
Exec := FactorExec.AsCubeExecutor;
Exec.PrepareExecute(Null);
Exec.PerformExecute;
Mat := Exec.Matrix;
Ite := Mat.CreateIterator;
Ite.Move(IteratorDirection.First);
While Ite.Valid Do
Debug.WriteLine(Ite.Value);
Ite.Move(IteratorDirection.Next);
End While;
End Sub uProc;
After executing the example the console window displays the time series values with composite 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.Matrix;
Imports Prognoz.Platform.Interop.Rds;
Imports Prognoz.Platform.Interop.ForeSystem;
…
[STAThread]
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
RubDesc: IMetabaseObjectDescriptor;
RubrIn: IRubricatorInstance;
Cub: ICubeInstance;
Dest: ICubeInstanceDestination;
FactorExec: IRubricatorFactorExecutor;
FactsLookup: IRubricatorFactsLookup;
Key: Array Of object;
i: Integer;
Exec: ICubeInstanceDestinationExecutor;
Mat: IMatrix;
Ite: IMatrixIterator;
Begin
mb := Params.Metabase;
RubDesc := MB.ItemById["FC"];
RubrIn := RubDesc.Open(Null) As IRubricatorInstance;
Cub := RubrIn As ICubeInstance;
Dest := Cub.Destinations.DefaultDestination;
Exec := Dest.CreateExecutor();
FactorExec := Exec As IRubricatorFactorExecutor;
FactsLookup := RubrIn.CreateFactsLookup();
i := FactsLookup.LookupFactorsC().Length;
Key := New object[i];
Key := FactsLookup.LookupFactorsC() As Array Of object;
FactorExec.SetCompoundFactorKeys(Key);
FactorExec.ValueKind := MetaAttributeKind.meakValue;
FactorExec.ValueId := "VL";
FactorExec.UseDwarf := True;
Exec := FactorExec.AsCubeExecutor();
Exec.PrepareExecute(Null);
Exec.PerformExecute(False);
Mat := Exec.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: