Item(Index: Integer): IVZTreeItem;
The Item property returns item from the collection of tree elements by the selected index.
Executing the example requires that the repository contains an express report with the EXP identifier. The module containing the example should have links to the Express, Metabase and Visualizators system assemblies. The specified procedure should be called from the Main entry point.
Determine identifiers of bubble tree root element and its children, which should be then deleted:
Sub UserProc;
Var
Metabase: IMetabase; // Metabase
EaxAnalyzer: IEaxAnalyzer; // Express report
BubbleTree: IVZBubbleTree; // Bubble tree
RootItem: IVZTreeItem; // Tree root element
Items: IVZTreeItems; // Child elements
Index: Integer;
Item: IVZTreeItem; // Tree item
Model: IVZTreeModel; // Tree model
Begin
// Get metabase object
Metabase := MetabaseClass.Active;
// Open express report
EaxAnalyzer := Metabase.ItemById("EXP").Edit As IEaxAnalyzer;
// Get bubble tree
BubbleTree := EaxAnalyzer.BubbleTree.BubbleTree;
// Get tree model
Model := BubbleTree.Model;
// Get root element of bubble tree
RootItem := Model.RootItem;
Debug.WriteLine("Root element identifier: " +
RootItem.ID);
// Get tree child elements
Items := RootItem.Items;
Debug.WriteLine("Child elements: ");
// Display identifiers of child elements
For Index := 0 To Items.Count-1 Do
// Get child elements by index
Item := Items.Item(Index);
Debug.WriteLine(Item.ID + ", parent: " + Item.Parent.ID);
// Delete element
Items.Remove(Index);
End For;
Debug.WriteLine("Number of elements after clearing: " +
RootItem.Items.Count.ToString);
End Sub UserProc;
After executing the example the development environment console window displays identifier of bubble tree root element and identifiers of its children which were then deleted:
Root element identifier: 10000
Children:
10001, parent: 10000
Number of elements after clearing: 0
See also: