IMDCalculationDatasetInstance.KeyToText

Syntax

KeyToText(Key: IMDCalculationFormulaElementKey): String;

Parameters

Key - unique element key.

Description

The KeyToText method returns the string view of the element, to which the Key unique key corresponds.

Example

Executing the example requires that the repository contains multidimensional calculation on DB server with the MDCalc_1 identifier.

Sub Main;

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 value of the key by free dimensions

Key.Item(i) := AttrInst.FindByKey(Index.Attributes.Item(0).Key).Value(0);

End For;

Debug.WriteLine(Dest.KeyToText(Key));

End Sub Main;

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 slices. String view of element is displayed in the development environment console.

See also:

IMDCalculationDatasetInstance