Cube: ICalculatedCubeInstance;
The Cube property determines a calculated cube that is data source.
Executing the example requires that the repository contains a form with the Button1 button and the CalcCubeFormulaEdit component named CalcCubeFormulaEdit1. The repository also contains a calculated cube with the Calc_Cube identifier. This cube has an unfixed dimension.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
CubeInst: ICalculatedCubeInstance;
Coord: ICalculatedCubeInstanceCoord;
Terms: ITermList;
i: Integer;
Begin
MB := MetabaseClass.Active;
CubeInst := MB.ItemById("Calc_Cube").Open(Null) As ICalculatedCubeInstance;
CalcCubeFormulaEdit1.Cube := CubeInst;
Coord := CubeInst.CreateCoord;
//The first coordinate
Coord.MatrixCoord.Item(0) := 0;
CalcCubeFormulaEdit1.PutCoord(Coord, 0);
Terms := CalcCubeFormulaEdit1.Terms;
i := Terms.Item(0).Text.Length;
//Sign +
CalcCubeFormulaEdit1.PutLiteral("+");
//The second coordinate
Coord.MatrixCoord.Item(0) := 1;
i := i + Terms.Item(1).Text.Length;
CalcCubeFormulaEdit1.PutCoord(Coord, i);
End Sub Button1OnClick;
After executing the example on clicking the button and data source, the cube with the Calc_Cube identifier is set for the CalcCubeFormulaEdit1 component. A component editing field contains three terms: two terms for cube coordinates and a literal term corresponding to + sign.
See also: