HasChildren: Boolean;
The HasChildren method returns the sign of existence of the child objects of the current objects.
Available values:
True. The object has direct children objects (access to them can be obtained in the IMetabaseObjectDescriptor.Children property) and has objects with attribute of lazy description loading (access to them can be obtained using the IMetabase.FetchItem, IMetabase.FetchItemById, IMetabase.FetchItems and IMetabase.FetchItemsById methods).
NOTE. To get an exact value of the collection element (taking into account user access permission to this element), it is recommended to download collection elements (Children.Count) after applying the HasChildren method and then get the exact value (Children.Item(i)).
False. The object does not have child objects.
Executing the example requires that the repository contains a time series database with the TSBD identifier.
Add a link to the Metabase system assembly.
Sub UserProg;
Var
MB: IMetabase;
MDesc: IMetabaseObjectDescriptor;
MDescr: IMetabaseObjectDescriptors;
i: integer;
Begin
MB := MetabaseClass.Active;
MDesc := Mb.ItemById("TSDB");
MDescr := MDesc.Children;
If MDesc.HasChildren = True Then
Debug.WriteLine("Child objects:");
Debug.Indent;
For i := 0 To MDescr.Count - 1 Do
MDesc := MDescr.Item(i);
Debug.WriteLine("Name: " + MDesc.Name + "; Identifier: " + MDesc.Id);
End For;
Debug.Unindent;
Else
Debug.WriteLine("No child objects.");
End If;
End Sub UserProg;
After executing the example, if there are child objects in the specified object, their names and identifiers are displayed in the development environment console.
See also: