CreateCoord: ICalculatedCubeInstanceCoord;
The CreateCoord method creates an object that represents a coordinate in a calculated cube.
Executing the example requires that the repository contains a calculated cube with the Calc_Cube identifier. The source cube and the calculated cube contain two dimensions that are not fixed.
Sub Main;
Var
MB: IMetabase;
CubeInst: ICalculatedCubeInstance;
Coord, SourceCoord: ICalculatedCubeInstanceCoord;
Formulas: ICalculatedCubeFormulas;
Formula: ICalculatedCubeFormula;
Begin
MB := MetabaseClass.Active;
CubeInst := MB.ItemById("Calc_Cube").Open(Null) As ICalculatedCubeInstance;
//Get coordinate in calculated cube
Coord := CubeInst.CreateCoord;
Coord.MatrixCoord.Item(0) := 0;
Coord.MatrixCoord.Item(1) := 0;
//Get coordinate from source
SourceCoord := CubeInst.CreateSourceCoord(CubeInst.Sources.Item(0));
SourceCoord.MatrixCoord.Item(0) := 0;
SourceCoord.MatrixCoord.Item(1) := 0;
Formulas := CubeInst.Formula(Coord);
//Get formula by specified coordinate
Formula := Formulas.Item(0);
Formula.Expression.AsString := SourceCoord.AsTerm + "* 180 / 3.14";
Formulas.Save;
CubeInst.SaveFormulas;
End Sub Main;
After executing the example the formula is changed for the obtained cube coordinate. The term, referring to an appropriate coordinate in the source cube, is used in the expression.
See also: