ElementKeyToText(Key: IMDCalculationFormulaElementKey): String;
Key. Unique key that corresponds to element in data source or data consumer.
The ElementKeyToText method returns string view of the element, to which the key passed by the Key parameter corresponds.
Executing the example requires that the repository contains multidimensional calculation on database server with the MDCalc_1 identifier.
Sub UserProc;
Var
MB: IMetabase;
MDInst: IMDCalculationInstance;
Dest: IMDCalculationDestinationInstance;
Slices: IMDCalculationSlicesInstance;
Slice: IMDCalculationSliceInstance;
Key: IMDCalculationFormulaElementKey;
Index: IDimIndex;
AttrInst: IDimAttributesInstance;
i: Integer;
Begin
MB := MetabaseClass.Active;
MDInst := MB.ItemById("MDCalc_1").Open(Null) As IMDCalculationInstance;
Dest := MDInst.Destination;
Slices := Dest.Slices;
Key := Dest.NewKey;
For i := 0 To Slices.Count - 1 Do
Slice := Slices.Item(i);
AttrInst := Slice.Dimension.Attributes;
Index := Slice.Index.Index;
// Set key value by free dimensions
Key.Item(i) := AttrInst.FindByKey(Index.Attributes.Item(0).Key).Value(0);
End For;
Debug.WriteLine(MDInst.ElementKeyToText(Key));
End Sub UserProc;
After executing the example a unique key is created. This unique key corresponds to the element of data consumer arranged by the first elements of dimensions. String view of element is displayed in the development environment console.
See also: