Add(Value: IRdsAttribute; Ascending: Boolean): IRdsSortAttribute;
Value. Attribute, which values are sorted.
Ascending. Direction of sorting.
The Add method adds sorting by the specified attribute with the set direction of sorting.
The Ascending parameter determines sorting direction. Available values:
True. Ascending sorting.
False. Descending sorting.
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(Null) As 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: