IRdsSortAttributes.Add

Syntax

Add(Value: IRdsAttribute; Ascending: Boolean): IRdsSortAttribute;

Parameters

Value. Attribute, which values are sorted.

Ascending. Direction of sorting.

Description

The Add method adds sorting by the specified attribute with the set direction of sorting.

Comments

The Ascending parameter determines sorting direction. Available values:

Example

Executing the example requires the MDM dictionary with the RDS_REPO identifier. This repository contains the MDM dictionary with the SORT identifier. Add links to the Metabase, Rds system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    RdsKey: Integer;
    DictObj: IMetabaseObjectDescriptor;
    DictInst: IRdsDictionaryInstance;
    Sorter: IRdsElementsSorter;
    Elems: IRdsDictionaryElements;
    Attrs: IRdsAttributes;
Begin
    Mb := MetabaseClass.Active;
    RdsKey := Mb.ItemById("RDS_REPO").Key;
    DictObj := Mb.ItemByIdNamespace("SORT", RdsKey);
    DictInst := DictObj.Open(NullAs IRdsDictionaryInstance;
    Elems := DictInst.Elements;
    Sorter := Elems.CreateSorter(Elems.Root);
    Attrs := DictInst.Dictionary.Attributes;
    Sorter.Attributes.Add(Attrs.FindById("Name"), True);
    Sorter.Sort(True);
    Sorter.Save;
End Sub UserProc;

After executing the example elements of the SORT dictionary are sorted by name. Direction of sorting is ascending.

See also:

IRdsSortAttributes