Book a Demo

Author Topic: Update multiple elements  (Read 2854 times)

sam spurling

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Update multiple elements
« on: March 13, 2009, 04:03:01 am »
Is there a way to update the status or any other property of an element for multiple elements at one time.
« Last Edit: March 13, 2009, 04:04:11 am by sspurling »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Update multiple elements
« Reply #1 on: March 13, 2009, 09:23:16 am »
Not in EA, though I have done this with an add-in before.

Thelonius

  • EA User
  • **
  • Posts: 274
  • Karma: +6/-0
  • I think. Therefore I get paid.
    • View Profile
Re: Update multiple elements
« Reply #2 on: March 13, 2009, 11:04:30 am »
Quote
Not in EA, though I have done this with an add-in before.

Simon - this capability would be especially useful for those of us who use Sparx EA for Enterprise Architecture purposes.

Can you point us to an 'add-in'? Is the 'add-in' a "roll your own" or is it purchaseable from an add-in software developer?

Thanks - Jon

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Update multiple elements
« Reply #3 on: March 13, 2009, 01:39:34 pm »
Sorry, just my own occaisionally useful add-in.  My C# function looks something like this.

Code: [Select]
void MoveDiagramSelectionToThisPackage(EA.Repository r, string Status)
{
    EA.Diagram d = r.GetCurrentDiagram();
    if (d == null)
        return;

    EA.Collection c = d.SelectedObjects;
    foreach (EA.DiagramObject o in d.SelectedObjects)
    {
        EA.Element e = r.GetElementByID(o.ElementID);
        if (e.Status != Status)
        {
            e.Status = Status;
            e.Update();
            r.AdviseElementChange(e.ElementID);
        }
    }
}

If you want to get more fancy, pass in a delegate taking an EA.Element that does the change.  If you wanted to optimize a bit more, collect all the IDs then do r.GetElementSet () instead of r.GetElementByID().

Dermot

  • EA Administrator
  • EA User
  • *****
  • Posts: 591
  • Karma: +7/-0
    • View Profile
Re: Update multiple elements
« Reply #4 on: March 13, 2009, 04:37:31 pm »
There is also a feature to update Status by package - see:
http://www.sparxsystems.com/uml_tool_guide/project_management/updatepkgstatus.html
Also: View | Element List - gives quick & simple method to run through and make changes across a set of listed elements.