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.
See also: