IRdsDictionaryElements.MoveTo

Syntax

MoveTo(SourceKey: Integer; TargetKey: Integer; MoveType: RdsMoveType);

Parameters

SourceKey. Key of a moved element.

TargetKey. Key of an element, relative to which move is executed.

MoveType. Position, to which the SourceKey element is moved relative to the TargetKey element.

Description

The MoveTo method moves MDM dictionary element into a specified position.

Comments

The SourceKey element can be moved relative to a dictionary root element. For this, it is necessary to pass value -2 (a dictionary root element) as the TargetKey parameter. An element can be moved to any position except for RdsMoveType.Before (up to a specified element).

It is not allowed to pass value -2 (a dictionary root element) as the SourceKey parameter.

Example

Executing the example requires an MDM repository with the RDS_REPO identifier that contains a dictionary with the OBJ_DICT identifier. It is also necessary to add links to the Metabase, Rds system assemblies.

    Sub UserProc;
    Var
        MB: IMetabase;
        RdsDescr: IMetabaseObjectDescriptor;
        Dict: IRdsDictionary;
        DictInst: IRdsDictionaryInstance;
        Elements: IRdsDictionaryElements;
        Elem1, Elem2: Integer;
    Begin
        MB := MetabaseClass.Active;
        RdsDescr := MB.ItemById("RDS_REPO");
        Dict := MB.ItemByIdNamespace("OBJ_DICT", RdsDescr.Key).Bind As IRdsDictionary;
        DictInst := Dict.Open(Null);
        Elements := DictInst.Elements;
    // Get key of the first element of a dictionary
        Elem1 := Elements.Child(-20);
    // Get key of the last element of a dictionary
        Elem2 := Elements.Child(-2, Elements.ChildrenCount(-2) - 1);
    // Move element
        Elements.MoveTo(Elem1, Elem2, RdsMoveType.Before);
    End Sub UserProc;

After executing the example the first element of a dictionary is moved before the last element of a dictionary.

See also:

IRdsDictionaryElements