IMDCalculationInstance.ElementKeyToText

Syntax

ElementKeyToText(Key: IMDCalculationFormulaElementKey): String;

Parameters

Key. Unique key that corresponds to element in data source or data consumer.

Description

The ElementKeyToText method returns string view of the element, to which the key passed by the Key parameter 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(MDInst.ElementKeyToText(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 dimensions. String view of element is displayed in the development environment console.

See also:

IMDCalculationInstance