The MDM dictionary data can be obtained in different forms:
Only dictionary elements.
Dictionary elements and groups.
Only dictionary groups.
To do this, 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:
0 - only dictionary elements.
1 - dictionary elements and groups.
2 - only dictionary groups.
If the RDSDIMTYPE parameter is not set, only dictionary elements are opened.
Executing the example requires that the repository contains an MDM dictionary with the OBJ_DICTIONARY identifier. The example also requires a form, the Button1 button and the following component on the form: 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;
Object: IMetabaseObjectDescriptor;
Params: IMetabaseObjectParams;
Param: IMetabaseObjectParam;
Values: IMetabaseObjectParamValues;
Dictionary: IRdsDictionaryInstance;
Dict: IRdsDictionary;
DimInstance: IDimInstance;
Elements: IDimElements;
Element, i: Integer;
Begin
Metabase := MetabaseClass.Active;
Object := Metabase.ItemById("OBJ_DICTIONARY");
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 dictionary is opened with the specified RDSDIMTYPE parameter value. Data is displayed as a tree in the DimensionTree component and is described in the Memo component.
The example of opening a dictionary with various values of the RDSDIMTYPE parameter:
RDSDIMTYPE=0
RDSDIMTYPE=1
RDSDIMTYPE=2
See also: