PutCoord(Coord: ICalculatedCubeInstanceCoord; [Position: Integer = -1]): Integer;
Coord - a cube coordinate, for which a term should be created in the editor.
Position - position in the editor, to which a term is placed. Position number is determined in symbols. By default, the -1 value is passed, the term is inserted to the end of the expression.
The PutCoord method places the term to the editor corresponding to the specified cube coordinate and returns its number in the collection of component terms.
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: