ChangePeriod(DateBegin: DateTime; DateEnd: DateTime);
DateBegin. Formula action start date that should be set.
DateEnd. Formula action end date that should be set.
The ChangePeriod method changes start and end dates of formula validation and corrects the periods of adjacent formulas.
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 UserProc;
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 UserProc;
After executing the example, start and end dates of the first formula action are changed for obtained cube coordinate. These dates are shifted to half a year forward, dates for other formulas are automatically adjusted.
See also: