FormulaNaming(DimensionKey: Integer): IDimensionModel;
DimensionKey - key of the dimension, for which attribute displayed in formula must be set.
The FormulaNaming property determines the attribute displayed in the elements names in calculated cube formulas.
Executing the example requires that the repository contains a calculated cube with the Calc_Cube identifier.
Sub Main;
Var
MB: IMetabase;
CubeInst: ICalculatedCubeInstance;
View: ICalculatedCubeFormulasView;
Dim: IDimensionModel;
i, j, Key: Integer;
Begin
MB := MetabaseClass.Active;
CubeInst := MB.ItemById("Calc_Cube").Open(Null) As ICalculatedCubeInstance;
View := CubeInst.View(Null);
For i := 0 To View.Count - 1 Do
Dim := View.Dimension(i);
Key := (Dim As IMetabaseObject).Key;
View.FormulaNaming(Key) := Dim.Attributes.Id;
View.ViewNaming(Key) := Dim.Attributes.Id;
End For;
For i := 0 To CubeInst.Sources.Count - 1 Do
View := CubeInst.View(CubeInst.Sources.Item(i));
For j := 0 To View.Count - 1 Do
Dim := View.Dimension(j);
Key := (Dim As IMetabaseObject).Key;
View.FormulaNaming(Key) := Dim.Attributes.Id;
View.ViewNaming(Key) := Dim.Attributes.Id;
End For;
End For;
CubeInst.SaveFormulas;
End Sub Main;
After executing the example a display of dimension elements of calculated cube and all source cubes are set. Identifiers of elements are displayed in dimensions and formulas.
See also: