Cube: ICalculatedCubeInstance;
The Cube property determines a calculated cube that is data source.
Executing the example requires a form, a button named Button1 on the form 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;
// First coordinate
Coord.MatrixCoord.Item(0) := 0;
CalcCubeFormulaEdit1.PutCoord(Coord,0);
Terms := CalcCubeFormulaEdit1.Terms;
i := Terms.Item(0).Text.Length;
// Sign +
CalcCubeFormulaEdit1.PutLiteral("+");
// 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 sets a data source that is a cube with the CALC_CUBE identifier for the CalcCubeFormulaEdit1 component. A component edit box contains three terms: two terms for cube coordinates and a literal term corresponding to the + sign.
See also: