Results 1 to 6 of 6
  1. #1

    How can I store tree nodes in an array?

    Dear forum members,

    I have a set of tree nodes as shown in picture attachment. The tree area is marked in red, which I want to store in an array. I understand the idea around predefining array values as examples show. But here I'd like to capture all the the tree nodes into an array and then use a loop (ex: for each) to process each node and then move on the next node until the last node is reached. There are about 2500 such nodes. I am currently stuck at how to capture all these nodes into an array and then loop through each one. How would I be able to achieve this?

    I appreciate your time and help. Thank you.
    Attached Images Attached Images

  2. #2

    Re: How can I store tree nodes in an array?

    You would need to use the TreeModel to traverse all nodes

    Set oModel = ...JavaTree().object.getModel()

    Then use the functions from below

    You may need some help from developers to get a working code for the same

  3. #3

    Re: How can I store tree nodes in an array?

    Tarun, thank you for your reply. So it looks like there might be some heavy lifting involved. I guess I was under the wrong impression that this was pretty straight forward.

    I've never used the getModel() method before. I'll try it first thing when I get into work in the morning. I'll try to find a working solution. The problem with contacting developers is that they are based out of Germany with one implementation consultant working at our office. He wasn't too helpful the last time around. Will try again.

    If there's anyone who have ideas on how to get the tree nodes into an array please let me know. Thanks again.

  4. #4

    Re: How can I store tree nodes in an array?

    I guess I should have phrased my question differently. I'm sorry about that. I just wanted a way to loop through each node on the tree. I guess it just complicates matters to first store all nodes in an array and then loop through each node iteratively.

    Instead Cody Marcel @ HP forums, posted a simple solution for looping through each node without needing to store all the tree nodes in an array.

    For i = 0 To JavaTree(...).GetROProperty("items count") - 1
    this = JavaTree(...).GetItem(i)
    JavaTree(...).Activate this


    That allows me to execute functionality associated with each node. Thanks again for looking into the issue! If there are alternative methods to do the same operation please share.

  5. #5

    Re: How can I store tree nodes in an array?

    It works even if nodes are not expanded?

  6. #6

    Re: How can I store tree nodes in an array?

    It probably won't work if the nodes were not expanded. I do have code which expands the nodes first. Then I use the for loop to activate each node on the tree.

    JavaWindow("Heiler Product Manager").JavaTab("OverviewTab").Select("Context selection")
    'This line selects the tab which contains the tree
    wait 2
    JavaWindow("Heiler Product Manager").JavaTree("DataTransferTree").RefreshObje ct
    wait 2
    JavaWindow("Heiler Product Manager").JavaTree("DataTransferTree").Expand("Dat a transfer")
    wait 4

    The RefreshObject method is probably unnecessary though.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 03:38 PM.

Copyright BetaSoft Inc.