IMDCalculationFormulas.CheckPeriods

Syntax

CheckPeriods;

Description

The CheckPeriods method checks if there are formulas with crossing actual periods.

Comments

This method can be used if formulas actual periods are edited directly in the table of multidimensional calculation formulas on database server.

Example

Executing the example requires that the repository contains multidimensional calculation on DB server with the MDCalc_1 identifier. Time dependency is enabled for formulas.

Sub Main;

Var

MB: IMetabase;

MDInst: IMDCalculationInstance;

Source: IMDCalculationSourceInstance;

Dest: IMDCalculationDestinationInstance;

Slices: IMDCalculationSlicesInstance;

Formulas: IMDCalculationFormulas;

DestCoo: IMatrixCoord;

ElementKey: IMDCalculationFormulaElementKey;

i: Integer;

Begin

MB := MetabaseClass.Active;

MDInst := MB.ItemById("MDCalc_1").Open(Null) As IMDCalculationInstance;

Dest := MDInst.Destination;

DestCoo := Dest.NewCoord;

Slices := Dest.Slices;

For i := 0 To Slices.Count - 1 Do

DestCoo.Item(i) := 0;

End For;

ElementKey := Dest.CoordToKey(DestCoo);

ElementKey.FactIndex := 0;

Source := MDInst.Sources.Item(0);

Slices := Source.Slices;

Formulas := MDInst.ReadFormulas(ElementKey);

Try

Formulas.CheckPeriods;

Debug.WriteLine("Formulas operation periods are correct");

Except On Err: Exception Do

Debug.WriteLine("Error in the formulas operation periods. ");

Debug.WriteLine(Err.Message);

End Try;

End Sub Main;

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:

IMDCalculationFormulas

IMDCalculationFormula.ChangePeriod