KeyToText(Key: IMDCalculationFormulaElementKey): String;
Key. Element unique key.
The KeyToText method returns string view of the element corresponding to the unique key.
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 slices
Key.Item(i) := AttrInst.FindByKey(Index.Attributes.Item(0).Key).Value(0);
End For;
Debug.WriteLine(Dest.KeyToText(Key));
End Sub UserProc;
After executing the example a unique key is created. This unique key corresponds to the data consumer element arranged by the first elements of slices. String view of element is displayed in the development environment console.
See also: