Clear;
The Clear method clears the collection of visualizer tree elements.
Executing the example requires that the repository contains an express report with the EXPRESS identifier. The unit 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.
Get the root element of bubble tree and its children, add the element and then delete all elements:
Sub UserProc;
Var
Metabase: IMetabase;
EaxAnalyzer: IEaxAnalyzer;
BubbleTree: IVZBubbleTree;
RootItem: IVZTreeItem;
Model: IVZTreeModel;
Items: IVZTreeItems;
Item: IVZTreeItem;
Begin
// Get the current repository
Metabase := MetabaseClass.Active;
// Get express report
EaxAnalyzer := Metabase.ItemById("EXPRESS").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("Number of elements before adding: " + RootItem.Items.Count.ToString);
// Add an element
Items := RootItem.Items;
Item := Items.Item(RootItem.Items.Count-1);
RootItem.Items.Add(Item);
Debug.WriteLine("Number of elements after adding: " + RootItem.Items.Count.ToString);
Debug.WriteLine("Number of elements before deleting: " + RootItem.Items.Count.ToString);
// Clear all elements in collection
RootItem.Items.Clear;
Debug.WriteLine("Number of elements after deleting: " + RootItem.Items.Count.ToString);
End Sub UserProc;
After executing the example all children of bubble tree root element are deleted, which is proved by notifications in the development environment console window:
Number of elements before adding: 1
Number of elements after adding: 2
Number of elements before deleting: 2
Number of elements after clearing: 0
See also: