ICalculatedCubeFormula.ChangePeriod

Syntax

ChangePeriod(DateBegin: DateTime; DateEnd: DateTime);

Parameters

DateBegin - date of the formula actual start, which must be set.

DateEnd - date of the formula actual end, which must be set.

Description

The ChangePeriod method changes start and end dates of formula validation and corrects the periods of adjacent formulas.

Example

Executing the example requires that the repository contains a calculated cube with the Calc_Cube identifier. The cube has two dimensions that are not fixed, also the dimension, controlling the choice of the formula actual period, is set.

Sub Main;

Var

MB: IMetabase;

CubeInst: ICalculatedCubeInstance;

Coord: ICalculatedCubeInstanceCoord;

Formulas: ICalculatedCubeFormulas;

Formula: ICalculatedCubeFormula;

d, d1: DateTime;

Begin

MB := MetabaseClass.Active;

CubeInst := MB.ItemById("Calc_Cube").Open(Null) As ICalculatedCubeInstance;

Coord := CubeInst.CreateCoord;

Coord.MatrixCoord.Item(0) := 0;

Coord.MatrixCoord.Item(1) := 0;

Formulas := CubeInst.Formula(Coord);

Formula := Formulas.Item(0);

d := Formula.DateBegin;

d1 := Formula.DateEnd;

d := DateTime.AddMonths(d, 6);

d1 := DateTime.AddMonths(d, 6);

Formula.ChangePeriod(d, d1);

Formulas.Save;

CubeInst.SaveFormulas;

End Sub Main;

After executing the example dates of the first formula actual start and end are changed for obtained cube coordinate. These dates are shifted to half a year forward, dates for other formulas are automatically adjusted.

See also:

ICalculatedCubeFormula