Opening MDM Dictionary by Different Dimensions

The MDM dictionary data can be obtained in different forms:

To do it, call the Open method from the MDM dictionary with the RDSDIMTYPE parameter. This parameter is integer and optional. The parameter value determines, to which type the MDM data should be cast:

If the RDSDIMTYPE parameter is not set, only dictionary elements are opened.

Executing the example requires that the repository contains the RDS_REPO MDM repository that contains the OBJ_DICTIONARY dictionary. It also requires a form with the Button1 button and the following components: UiDimension with the UiDimension1 identifier, UiRdsDictionary with the UiRdsDictionary1 identifier, IntegerEdit with the IntegerEdit1 identifier, Memo with the Memo1 identifier and the DimensionTree component. UiDimension1 is a data source for the DimensionTree component. For the IntegerEdit1 component, a value of the MinValue property is 0, MaxValue is 2.

The form looks as follows:

Enter value of the RDSDIMTYPE parameter in the IntegerEdit1 component and press the Open button. After that example is executed.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

Metabase: IMetabase;

RdsKey: Integer;

Object: IMetabaseObjectDescriptor;

Params: IMetabaseObjectParams;

Param: IMetabaseObjectParam;

Values: IMetabaseObjectParamValues;

Dictionary: IRdsDictionaryInstance;

Dict: IRdsDictionary;

DimInstance: IDimInstance;

Elements: IDimElements;

Element: Integer;

i: Integer;

Begin

Metabase := MetabaseClass.Active;

RdsKey := Metabase.GetObjectKeyById("RDS_REPO");

Object := Metabase.ItemByIdNamespace("OBJ_DICTIONARY", RdsKey);

Object := Object.Edit;

Params := Object.Params;

Param := Params.Add;

Param.Name := "RDSDIMTYPE";

Param.Id := "RDSDIMTYPE";

Param.DataType := DbDataType.Integer;

Values := Params.CreateEmptyValues;

Values.FindById("RDSDIMTYPE").Value := IntegerEdit1.Value;

Dictionary := Object.Open(Values) As IRdsDictionaryInstance;

DimInstance := Dictionary As IDimInstance;

UiDimension1.Instance := DimInstance;

Dict := Dictionary.Dictionary;

UiRdsDictionary1.Object := Dict;

UiRdsDictionary1.Open(Values);

UiRdsDictionary1.Active := True;

Memo1.Clear;

Elements := DimInstance.Elements;

For i := 0 To Elements.Count - 1 Do

Element := Elements.Elements.Element(i);

If Elements.IsGroup(Element)

Then Memo1.Lines.Add( Group: + Elements.Name(Element));

Else Memo1.Lines.Add(Element: + Elements.Name(Element));

End If;

End For;

End Sub Button1OnClick;

After executing the example the OBJ_DICTIONARY dictionary is opened with the set value of the RDSDIMTYPE parameter. Data is displayed as a tree in the DimensionTree component and is described in the Memo component.

See below example of opening a dictionary with various values of the RDSDIMTYPE parameter:

RDSDIMTYPE=0

RDSDIMTYPE=1

RDSDIMTYPE=2

See also:

Examples