Clear;
Clear();
The Clear method clears the collection of visualizer tree elements.
Executing the example requires that the repository contains express report with the EXPRESS identifier. The module containing the example should have links to the Express, Metabase and Visualizators system assemblies. The selected 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; // Metabase
EaxAnalyzer: IEaxAnalyzer; // Express report
BubbleTree: IVZBubbleTree; // Bubble tree
RootItem: IVZTreeItem; // Tree root element
Model: IVZTreeModel; // Tree model
Items: IVZTreeItems; // Children
Item: IVZTreeItem; // Tree element
Begin
// Get metabase object
Metabase := MetabaseClass.Active;
// Open 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
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Visualizators;
...
Public Shared Sub Main(Params: StartParams);
Var
Metabase: IMetabase; // Metabase
EaxAnalyzer: IEaxAnalyzer; // Express report
BubbleTree: IVZBubbleTree; // Bubble tree
RootItem: IVZTreeItem; // Tree root element
Model: IVZTreeModel; // Tree model
Items: IVZTreeItems; // Children
Item: IVZTreeItem; // Tree element
Begin
// Get metabase object
Metabase := Params.Metabase;
// Open 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;
System.Diagnostics.Debug.WriteLine("Number of elements before adding: " + RootItem.Items.Count.ToString());
// Add element
Items := RootItem.Items;
Item := Items.Item[RootItem.Items.Count-1];
RootItem.Items.Add(Item);
System.Diagnostics.Debug.WriteLine("Number of elements after adding: " + RootItem.Items.Count.ToString());
System.Diagnostics.Debug.WriteLine("Number of elements before deleting: " + RootItem.Items.Count.ToString());
// Clear all elements in collection
RootItem.Items.Clear();
System.Diagnostics.Debug.WriteLine("Number of elements after deleting: " + RootItem.Items.Count.ToString());
End Sub;
See also: