RefAttribute: IRdsAttribute;
RefAttribute: Prognoz.Platform.Interop.Rds.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.
Executing the example requires a form with the Button1 button, the RdsDictionaryBoxNet1 component, and the UiRdsDictionaryNet1 component that is a data source of the RdsDictionaryBoxNet1 component. The MDM dictionary with the SORT identifier and with the test1 attribute linked to the LinkMDM dictionary is connected to the UiRdsDictionaryNet1 component through the Object property.
The example is a handler of the Click event for the button.
Imports Prognoz.Platform.Interop.Forms;
Imports Prognoz.Platform.Interop.Rds;
…
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
Dict: IRdsDictionaryInstance;
Attrs: IRdsAttributes;
SAttr: IRdsSortAttribute;
Sorter: IRdsElementsSorter;
Elems: IRdsDictionaryElements;
Attr1: IRdsAttribute;
Begin
Dict := RdsDictionaryBoxNet1.Source.CtrlBox.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);
System.Diagnostics.Debug.WriteLine(SAttr.RefAttribute.Name);
Sorter.Sort(False);
RdsDictionaryBoxNet1.CtrlBox.RefreshElements();
Sorter.Save();
End Sub;
After executing the example, the SORT dictionary elements are sorted by the test2 attribute of the LinkMDM dictionary.
See also: