IVZTreeItems.Item

Fore Syntax

Item(Index: Integer): IVZTreeItem;

Fore.NET Syntax

Item[Index: System.Int32]: Prognoz.Platform.Interop.Visualizators.IVZTreeItem;

Description

The Item property returns item from the collection of tree elements by the selected index.

Fore Example

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 selected 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

Fore.NET Example

Executing the example requires that the repository contains an express report with the EXP identifier. The selected procedure is the Main entry point in the Program module of the .NET assembly. The Express, Metabase and Visualizators assemblies should be imported to this module from the Prognoz.Platform.Interop system assembly.

Determine identifiers of bubble tree root element and its child items, which should be then deleted:

Public Shared Sub Main(Params: StartParams);
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 := Params.Metabase;
    // 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;
    System.Diagnostics.Debug.WriteLine("Root element identifier: " +
        RootItem.ID);
    // Get tree child elements
    Items := RootItem.Items;
    System.Diagnostics.Debug.WriteLine("Child elements: ");
    // Display identifiers of child elements
    For Index := 0 To Items.Count-1 Do
        // Get child element by index
        Item := Items.Item[Index];
        System.Diagnostics.Debug.WriteLine(Item.ID + ", parent: " + 
            Item.Parent.ID);
        // Delete element
        Items.Remove(Index);
    End For;
    System.Diagnostics.Debug.WriteLine("Number of elements after clearing: " + 
        RootItem.Items.Count.ToString());   
End Sub;

The result of the executed example is the same as that, executed for Fore language.

See also:

IVZTreeItems