Book a Demo

Author Topic: Move a Requirement from one package to another  (Read 4024 times)

khalidlkhan

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Move a Requirement from one package to another
« on: April 25, 2007, 05:55:10 am »
Hi,

I would like to programmatically move an Element of type "Requirement" from one package to another. I have tried the following approach:

element.ParentID = destPackage.PackageID
element.Update

This does not return an error (ie Update result is true) but neither is the read/write ParentID property updated to the new packageID

Anyone point me in the right direction.

Thanks in advance

PS I am using EA build 804

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Move a Requirement from one package to another
« Reply #1 on: April 25, 2007, 10:54:57 am »
The ParentID is a bit different from what you are using it for.

Try using the PackageID instead.

However, if this does not work, you might be better off to try adding the element to the other package's Elements collection directly.
No, you can't have it!

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Move a Requirement from one package to another
« Reply #2 on: April 25, 2007, 02:21:52 pm »
The ParentID is used when nesting elements within other elements in the tree.  As Midnight suggests, I believe that to move the element to another package you should set the Element.PackageID value.

khalidlkhan

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Move a Requirement from one package to another
« Reply #3 on: April 25, 2007, 09:20:28 pm »
As simple as that! Tried it and works great.

Many thanks.