IRdsSortAttribute.Index

Fore Syntax

Index: Integer;

Fore.NET Syntax

Index: System.Int32;

Description

The Index property returns index of the attribute of sorting in the collection.

Fore Example

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. An MDM dictionary is connected to the UiRdsDictionary1 component via the Object property. Add links to the ExstCtrls, Forms, Metabase and Rds system assemblies.

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;
Begin
    Dict := RdsDictionaryBox1.Source.Instance;
    Elems := Dict.Elements;
    Sorter := Elems.CreateSorter(Elems.Root);
    Attrs := Dict.Dictionary.Attributes;
    SAttr := Sorter.Attributes.Add(Attrs.FindById("Name"), True);
    debug.WriteLine(SAttr.Index);
    Sorter.Sort(False);
    RdsDictionaryBox1.RefreshElements;
End Sub Button1OnClick;

After executing the example, clicking the Button1 button sorts by the Name attribute and displays sorting attribute index in the console window.

Fore.NET Example

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. An MDM dictionary is connected to the UiRdsDictionaryNet1 component via the Object property. Add links to the Forms.NET, Forms and Rds system assemblies.

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;
Begin
    Dict := RdsDictionaryBoxNet1.Source.Instance;
    Elems := Dict.Elements;
    Sorter := Elems.CreateSorter(Elems.Root);
    Attrs := Dict.Dictionary.Attributes;
    SAttr := Sorter.Attributes.Add(Attrs.FindById("Name"), True);
    System.Diagnostics.Debug.WriteLine(SAttr.Index);
    Sorter.Sort(False);
    RdsDictionaryBoxNet1.CtrlBox.RefreshElements();
End Sub;

After executing the example, clicking the Button1 button sorts by the Name attribute and displays sorting attribute index in the console window.

See also:

IRdsSortAttribute