CheckPeriods;
The CheckPeriods method checks if there are formulas with crossing actual periods.
This method can be used if formulas actual periods are edited directly in the table of multidimensional calculation formulas on database server.
Executing the example requires that the repository contains multidimensional calculation on database server with the MDCalc_1 identifier. Time dependency is enabled for formulas.
Sub UserProc;
Var
MB: IMetabase;
MDInst: IMDCalculationInstance;
Source: IMDCalculationSourceInstance;
Dest: IMDCalculationDestinationInstance;
Slices: IMDCalculationSlicesInstance;
Formulas: IMDCalculationFormulas;
DestCoord: IMatrixCoord;
ElementKey: IMDCalculationFormulaElementKey;
i: Integer;
Begin
MB := MetabaseClass.Active;
MDInst := MB.ItemById("MDCalc_1").Open(Null) As IMDCalculationInstance;
Dest := MDInst.Destination;
DestCoord := Dest.NewCoord;
Slices := Dest.Slices;
For i := 0 To Slices.Count - 1 Do
DestCoord.Item(i) := 0;
End For;
ElementKey := Dest.CoordToKey(DestCoord);
ElementKey.FactIndex := 0;
Source := MDInst.Sources.Item(0);
Slices := Source.Slices;
Formulas := MDInst.ReadFormulas(ElementKey);
Try
Formulas.CheckPeriods;
Debug.WriteLine("Formula actual periods are correct");
Except On Err: Exception Do
Debug.WriteLine("Error in formula actual periods. ");
Debug.WriteLine(Err.Message);
End Try;
End Sub UserProc;
After executing the example it is checked if there are crossing formulas actual periods by the specified coordinate. If there are crossing periods, an exception is thrown, error text is displayed in the development environment console.
See also: