🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

collector name based on node id

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

Hello,

 

      i'm trying to get collector name based on node id with the following script.

 

 set node(id) '
301388
210613
254295
151336
'      
foreach index [array names node] {
   puts '$node($index)'
   *createmark nodes 1 $node($index)  
   *findmark nodes 1 1 1 elems 0 2
   set elems [hm_getmark elems 2]
   foreach elemid $elems {puts [hm_getentityvalue elems $elemid collector.name 1 -byid]}
}

issue: script outs collector name corresponding to last node (151336) only please help me.

 

Find more posts tagged with

Sort by:
1 - 3 of 31
    User: "llyle_20499"
    New Altair Community Member
    Updated by llyle_20499

    Hi,

     

    Your first foreach is wrong, considering you're only interested in node(id) you can give it directly. 

     

    foreach nodeID $node(id) {
       puts $nodeID--nodeID
       *createmark nodes 1 $nodeID
       *findmark nodes 1 1 1 elems 0 2
       set elems [hm_getmark elems 2]
       puts $elems--elems;
      foreach elemid $elems {puts [hm_getentityvalue elems $elemid collector.name 1 -byid]}
    }

    User: "sandeepballiwar"
    New Altair Community Member
    Updated by sandeepballiwar

    instead of second for loop, you can use the below commands

     

           *createmark elems 1 'by node' $node;

           if {[hm_marklength elems 1]} {

                 set lst_Comps [eval hm_parentcomplist id [hm_getmark elems 1]];

            }
     

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Hello Mr. Livil, Mr. Sandeep,

     

               Thank you 'it's working'.

    Regards,

    Anil.