ByScenario: Boolean;
ByScenario: boolean;
The ByScenario property determines whether validation must be calculated in the scenarios dimension.
Available values:
True. Calculate validation in the scenarios dimension.
False. Default value. Calculate validation by relevant data.
Executing the example requires a time series database with the FC_COMM identifier. Add links to the Cubes, Dimensions, Matrix, Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Inst: IRubricatorInstance;
ArrVali: Array[0..1] Of Integer;
MatCop, Mat: IMatrix;
CooSrc, CooRes: IMatrixCoord;
ItSrc, ItRes: IMatrixIterator;
vVal: Variant;
ValiDExecKey: Integer;
ValiRun: IValidationExecRun;
ValiData: IValidationExecData;
Sel: IDimSelectionSet;
Revi: IRubricatorRevision;
bByScenario: Boolean;
Begin
mb := MetabaseClass.Active;
Inst := mb.ItemById("FC_COMM").Open(Null) As IRubricatorInstance;
ValiDExecKey := 80;
ValiData := Inst.GetValidationExecData(ValiDExecKey, DictionaryGetDataOptions.None);
bByScenario := ValiData.ByScenario;
Sel := Null;
ValiRun := Inst.LoadValidationRun(ValiData, New ValidationExecSelection.CreateSelection(Sel));
Mat := ValiRun.Matrix;
MatCop := ((New MatrixFactory.Create) As IMatrixFactory).CreateMatrix(Mat.Dimensions);
MatCop.OperationMatrix(MatrixOperation.Append, Mat);
Mat.Clear;
Mat.ValueFlag := 1;
ItSrc := MatCop.CreateIterator;
CooSrc := MatCop.CreateCoord;
ItRes := Mat.CreateIterator;
CooRes := Mat.CreateCoord;
ItSrc.Move(IteratorDirection.First);
While ItSrc.Valid Do
ItSrc.PutCurrentPos(CooSrc);
CooRes.Assign(CooSrc);
ItRes.PutCoord(CooRes);
ItRes.ValueFlag := 0;
vVal := ItSrc.Value;
If Not vVal.IsEmpty Then
ItRes.Value := (vVal As Double) = 0.0 ? 0 : 1;
End If;
ItRes.ValueFlag := 1;
ItSrc.Move(IteratorDirection.Next);
End While;
ValiData := Inst.GetValidationExecData(-1, DictionaryGetDataOptions.Create);
ValiData.Name := (Inst As IMetabaseObjectInstance).Object.Name;
ValiData.ByScenario := bByScenario;
ArrVali[0] := 3668;
ArrVali[1] := 3677;
ValiData.Validations := ArrVali;
(ValiData As IRubricatorRecord).Save;
ValiDExecKey := ValiData.Key;
ValiRun.EphemeralFacts := False;
Debug.WriteLine("Indicates whether scenarios are calculated in dimension: " + ValiRun.ByScenario.ToString);
Revi := Inst.OpenRevision("Validation");
ValiRun.Revision := Revi;
Inst.SaveValidationRun(ValiRun, ValiData);
End Sub UserProc;
After executing the example data on validation with the 80 key, for which indicator of calculation by scenarios is set, are loaded. Then this data is saved into a new validation calculation and in the dimension by scenarios.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Rds;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Inst: IRubricatorInstance;
ArrVali: Array[0..1] Of Integer;
MatCop, Mat: IMatrix;
CooSrc, CooRes: IMatrixCoord;
ItSrc, ItRes: IMatrixIterator;
vVal: object;
ValiDExecKey: uinteger;
ValiRun: IValidationExecRun;
ValiData: IValidationExecData;
Sel: IDimSelectionSet;
Revi: IRubricatorRevision;
bByScenario: Boolean;
ExecSel: ValidationExecSelection;
Begin
mb := Params.Metabase;
Inst := mb.ItemById["FC_COMM"].Open(Null) As IRubricatorInstance;
ValiDExecKey := 21;
ValiData := Inst.GetValidationExecData(ValiDExecKey, DictionaryGetDataOptions.dgdoNone);
bByScenario := ValiData.ByScenario;
Sel := Null;
ExecSel := New ValidationExecSelectionClass.Create();
ExecSel.CreateSelection(Sel);
ValiRun := Inst.LoadValidationRun(ValiData, ExecSel);
Mat := ValiRun.Matrix;
MatCop := ((New MatrixFactory.Create()) As IMatrixFactory).CreateMatrix(Mat.Dimensions);
MatCop.OperationMatrix(MatrixOperation.moAppend, Mat);
Mat.Clear();
Mat.ValueFlag := 1;
ItSrc := MatCop.CreateIterator();
CooSrc := MatCop.CreateCoord();
ItRes := Mat.CreateIterator();
CooRes := Mat.CreateCoord();
ItSrc.Move(IteratorDirection.itdFirst);
While ItSrc.Valid Do
ItSrc.PutCurrentPos(CooSrc);
CooRes.Assign(CooSrc);
ItRes.PutCoord(CooRes);
ItRes.ValueFlag := 0;
vVal := ItSrc.Value;
If Not (vVal = Null) Then
ItRes.Value := (vVal As Double) = 0.0 ? 0 : 1;
End If;
ItRes.ValueFlag := 1;
ItSrc.Move(IteratorDirection.itdNext);
End While;
ValiData := Inst.GetValidationExecData(-1 As uinteger, DictionaryGetDataOptions.dgdoCreate);
ValiData.Name := (Inst As IMetabaseObjectInstance).Object.Name;
ValiData.ByScenario := bByScenario;
ArrVali[0] := 3668;
ArrVali[1] := 3677;
ValiData.Validations := ArrVali;
(ValiData As IRubricatorRecord).Save();
ValiDExecKey := ValiData.Key;
ValiRun.EphemeralFacts := False;
System.Diagnostics.Debug.WriteLine("Indicates whether calculation is executed in scenarios dimension: " + ValiRun.ByScenario.ToString());
Revi := Inst.OpenRevision("Validation");
ValiRun.Revision := Revi;
Inst.SaveValidationRun(ValiRun, ValiData);
End Sub;
See also: