IRdsDictionaryElements.Attribute

Fore Syntax

Attribute(Element: Integer; AttributeKey: Integer): Variant;

Fore.NET Syntax

Attribute[Element: uinteger; AttributeKey: uinteger]: object;

Parameters

Element. Key of the element, for which attribute value should be obtained.

AttributeKey. Key of the attribute, which value should be obtained.

Description

The Attribute property returns the name of the specified attribute for the set MDM dictionary element.

Comments

By default only values of system attributes are available. To get values of system and custom attributes, set the IRdsDictionaryInstance.FetchAll property to True.

Fore Example

Executing the example requires that the repository contains an MDM repository with the MDM_REPO identifier. The repository must contain a table MDM dictionary with the EXP_DICT identifier.

Add links to the Metabase, Rds system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MdmKey: Integer;
    Dict: IRdsDictionary;
    DictInst: IRdsDictionaryInstance;
    Elements: IRdsDictionaryElements;
    Attrs: IRdsAttributes;
    i, El, AttrKey: Integer;
Begin
    MB := MetabaseClass.Active;
    MdmKey := MB.ItemById(
"MDM_REPO").Key;
    Dict := MB.ItemByIdNamespace(
"EXP_DICT", MdmKey).Bind As IRdsDictionary;
    Attrs := Dict.Attributes;
    AttrKey := Attrs.Name.Key; 
// attribute key
    DictInst := Dict.Open(Null);
    Elements := DictInst.Elements;
    
For i := 0 To Elements.RootItem.ChildrenCount - 1 Do
        El := Elements.Child(Elements.Root, i);
        Debug.WriteLine(Elements.Attribute(El, AttrKey));
    
End For;
End Sub UserProc;

Example execution result: console window displays value of the Name attribute for all dictionary root elements.

Fore.NET Example

Executing the example requires that the repository contains an MDM repository with the MDM_REPO identifier. The repository must contain a table MDM dictionary with the EXP_DICT identifier.

Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MdmKey, AttrKey, El: uinteger;
    Dict: IRdsDictionary;
    DictInst: IRdsDictionaryInstance;
    Elements: IRdsDictionaryElements;
    Attrs: IRdsAttributes;
    i: Integer;
Begin
    MB := Params.Metabase;
    MdmKey := MB.ItemById["MDM_REPO"].Key;
    Dict := MB.ItemByIdNamespace["EXP_DICT", MdmKey].Bind() As IRdsDictionary;
    Attrs := Dict.Attributes;
    AttrKey := Attrs.Name.Key; // attribute key
    DictInst := Dict.Open(Null);
    Elements := DictInst.Elements;
    For i := 0 To Elements.RootItem.ChildrenCount - 1 Do
        El := Elements.Child[Elements.Root, i];
        System.Diagnostics.Debug.WriteLine(Elements.Attribute[El, AttrKey]);
    End For;
End Sub;

Example execution result: console window displays value of the Name attribute for all dictionary root elements.

See also:

IRdsDictionaryElements