AttributeKey: Integer;
The AttributeKey property returns the key of an attribute.
Executing the example requires a form with the Button1 button, the MetaAttributesBreadcrumb component and the MetaAttributesTreeList component with the MetaAttributesTreeList1 identifier, also the Memo component with the Memo1 identifier is required. The same time series database is set for the MetaAttributesBreadcrumb and MetaAttributesTreeList components. The MetaAttributesBreadcrumb component determines the value of the Breadcrumb property for MetaAttributesTreeList.
After launching the form, an attribute, that determines the time series database tree hierarchy, must be selected in the MetaAttributesBreadcrumb component. Then the user should select hierarchy elements of the MetaAttributesBreadcrumb component and click the button. The example will be executed.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Nodes: ITreeListSelection;
Node: ITreeListNode;
MetaAttrTLN: IMetaAttributesTreeListNode;
AttrValueTLN: IAttributeValueTreeListNode;
Keys: Array Of Integer;
Begin
Nodes := MetaAttributesTreeList1.Selection;
For Each Node In Nodes Do
MetaAttrTLN := Node As IMetaAttributesTreeListNode;
If MetaAttrTLN <> Null Then
If MetaAttrTLN.Type = MetaAttributesNodeType.AttributeValueNode Then
AttrValueTLN := MetaAttrTLN As IAttributeValueTreeListNode;
Memo1.Lines.Add("The selected element: " + AttrValueTLN.Text);
Memo1.Lines.Add(" Attribute: " + AttrValueTLN.AttributeName);
Memo1.Lines.Add(" The attribute key: " + AttrValueTLN.AttributeKey.ToString);
Memo1.Lines.Add(" The attribute value: " + AttrValueTLN.Value.ToString);
Keys := AttrValueTLN.GetKeys(AttrValueTLN.AttributeName);
Memo1.Lines.Add(" Time series count:" + Keys.Length.ToString);
End If;
End If;
End For;
End Sub Button1OnClick;
After executing the example the information of hierarchy selected root elements, which values are determined by dictionary data, and the elements names are displayed in the Memo1 component.
See also: