Item(Index: Integer): Variant;
Index. Free dimension index of data source or data consumer, by which a unique key value must be determined.
The Item property determines a value of unique key according to the specified dimension. Value of the attribute, by which dimension index is created, must be specified as a value of this property.
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;
A unique key is created after executing the example. 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: