Book a Demo

Author Topic: To know the type of object using parentid  (Read 5770 times)

syedmohdtauseef

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
To know the type of object using parentid
« on: September 18, 2006, 10:15:35 pm »
Hi  

When i am selecting any element in project browser  then how should i know it's parent as well as it's child information.I am trying to find the type whether it is package ,element or diagram using selected object's (in project explorer)parentid.

Can anyone help me in finding out this problem.
 
Tauseef  
Software Engineer

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: To know the type of object using parentid
« Reply #1 on: September 19, 2006, 12:04:29 am »
I am not sure if this is what you ae after, but...

Select the element in the project browser.
Press left arrow key.

bruce
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

thomaskilian

  • Guest
Re: To know the type of object using parentid
« Reply #2 on: September 19, 2006, 07:05:21 am »
Maybe View/Other/Element Browser can help?

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: To know the type of object using parentid
« Reply #3 on: September 19, 2006, 11:24:40 pm »
Quote
When i am selecting any element in project browser  then how should i know it's parent as well as it's child information.


If Element.ParentID is non-zero then its parent is an element. You can use Repository.GetElementByID() to retrieve the parent.

If Element.ParentID is zero then it doesn't have a parent, but you can find out which package it's in by passing Element.PackageID to Repository.GetPackageByID().

You can find its children by iterating through the collections Element.Elements and Element.EmbeddedElements.

This is all described in the EA help file under Automation and Scripting.

I hope this helps.
The Sparx Team
[email protected]