Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: palim on March 04, 2010, 02:47:39 am
-
Hello guys,
I`m importing requirements via a MS-Excel macro into EA.
Momentarily, every element is being imported into one package.
However, I`ve seen that elements can be grouped under an element.
Example:
There is an element "req1 - parent".
Also, there are elements named "req1 - sibling A", "req1- sibling B", and so forth.
On the Project Browser, it is possible to select "req1 - sibling A", "req1 - sibling B" and draw it under "req1- parent".
After that, the "plus" icon appears.
Is there any way to do this programmatically?
I checked the element`s reference and there is a method called "IsLeaf()". Can this be used for that?
Does anybody have a small code snippet?
Best regards,
palim
-
Is there any way to do this programmatically?
Set the Element.ParentID value of "req1 - sibling A" to the Element.ElementID value of "req1 - parent".
-
As KP said - To nest an existing element under another existing element, assign the ID of the parent element to Element.ParentID of the child. NOTE: both elements should already be in the same package. If not, you might also need to set the PackageID.
To browse items that are nested under the current context, you can use the Element.Elements collection.
E.g.
Requirement2.ParentID = Requirement1.ElementID
Requirement2.Update
Requirement1.Elements.Refresh
' Should now be able to access Requirement2 within the Elements collection of Requirement1.
-
Hello KP and Aaron B,
it`s working.
Thank you very much :-)
Best regards,
palim