References: String;
The References property determines the list of units/forms containing the custom functions that are used to create an expression.
Identifiers of units/forms in the list are separated by the ";" symbol. All the functions contained in these units and used to create an expression must be declared with the Public modifier.
Executing the example requires a calculated cube with the Virt_Cube identifier and the Module_1, Module_2 units containing the custom functions MyFunc, MyFunc1. These functions calculate values for the specified cube coordinates.
Add links to the Cubes, Matrix, and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
CCI: ICalculatedCubeInstance;
Coo: ICalculatedCubeInstanceCoord;
Formulas: ICalculatedCubeFormulas;
Formula: ICalculatedCubeFormula;
Expr: IExpression;
i: Integer;
Begin
Mb := MetabaseClass.Active;
CCI := Mb.ItemById("Virt_Cube").Open(Null) As ICalculatedCubeInstance;
Coo := CCI.CreateCoord;
For i := 0 To Coo.MatrixCoord.Count - 1 Do
Coo.MatrixCoord.Item(i) := 0;
End For;
Formulas := CCI.Formula(Coo);
Formula := Formulas.Item(0);
Expr := Formula.Expression;
Expr.References := "Module_1;Module_2";
Expr.AsString := "MyFunc-MyFunc1";
Formulas.Save;
CCI.SaveFormulas;
End Sub UserProc;
After executing the example one formula is added in the calculated cube by the specified coordinate. The formula expression will use the custom functions contained in the Module_1 and Module_2 units.
See also: