Book a Demo

Author Topic: Add existing Element to ConveyedItems  (Read 5898 times)

Viking

  • EA User
  • **
  • Posts: 478
  • Karma: +2/-2
    • View Profile
Add existing Element to ConveyedItems
« on: August 08, 2020, 03:38:18 am »
Hi,

I try to add an existing Element to ConveyedItems:

EA.Element returnObject = aConnector.ConveyedItems.AddNew(newElement.ElementGUID, null);
bool returnCode = returnObject.Update()

returnObject is always null. So Update() is not possible.

The Sparx documentation says: “Also note that you must call Update() on the returned object to complete the AddNew. If Update() is not called the object is left in an indeterminate state.”

Qwerty says in https://www.sparxsystems.com/forums/smf/index.php/topic,5663.msg126085.html#msg126085: It “appears that (EAUI) here you don't get a result object for a update but the AddNew adds the conveyed item directly. Just omit the Update.“

What is correct ?

Furthermore, is null correct or “” in AddNew() ?

Many thanks in advance, V.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Add existing Element to ConveyedItems
« Reply #1 on: August 08, 2020, 05:57:47 am »
Not using that. But I guess you need to update the connector.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Add existing Element to ConveyedItems
« Reply #2 on: August 08, 2020, 03:59:33 pm »
Yes, seems like this is an exception to the regular behavior of EA.Collection.AddNew

Normally this method is only used to create new items, an never to add exisitng elements to a collection, and then it makes sense to call Update() on the new object.
In this case, since it is not creating anything new you don't need to save that using Update()

As suggested by Q, you might need to update the connector.

Geert

Viking

  • EA User
  • **
  • Posts: 478
  • Karma: +2/-2
    • View Profile
Re: Add existing Element to ConveyedItems
« Reply #3 on: August 12, 2020, 03:54:58 am »
Many thanks @qwerty and @Geert.