RefAttribute: IRdsAttribute;
The RefAttribute property determines connected attribute of the MDM dictionary elements sorting.
Executing the example requires a form with the Button1 button, the RdsDictionaryBox1 component, and the UiRdsDictionary1 component that is a data source of the RdsDictionaryBox1 component. The MDM dictionary with the SORT identifier and with the test1 attribute linked to the LinkMDM dictionary is connected to the UiRdsDictionary1 component through the Object property.
The example is a handler of the OnClick event for the button.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Dict: IRdsDictionaryInstance;
Attrs: IRdsAttributes;
SAttr: IRdsSortAttribute;
Sorter: IRdsElementsSorter;
Elems: IRdsDictionaryElements;
Attr1: IRdsAttribute;
Begin
Dict:= RdsDictionaryBox1.Source.Instance;
Elems:= Dict.Elements;
Sorter:= Elems.CreateSorter(Elems.Root);
Attrs:= Dict.Dictionary.Attributes;
Attr1:= Attrs.FindById("test1");
SAttr:= Sorter.Attributes.AddRefAttribute(attr1, attr1.Link.Reference.Dictionary.Attributes.FindById("test2"), True);
debug.WriteLine(SAttr.RefAttribute.Name);
Sorter.Sort(False);
RdsDictionaryBox1.RefreshElements;
Sorter.Save;
End Sub Button1OnClick;
After executing the example, the SORT dictionary elements are sorted by the test2 attribute of the LinkMDM dictionary.
See also: