Book a Demo

Author Topic: Updating same attribute of multiple elements  (Read 8329 times)

KrugerPe

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Updating same attribute of multiple elements
« on: September 08, 2016, 11:31:33 pm »
Hi, I want to set e.g. status attribute of a child element (Task element) which is owned by a Requirement element) to default to the status of the parent id on creation.  Has anyone done this before?

Otherwise, can I do a bulk update of the status attribute of an element (t_object) using the EA interface?  In the past I "cheated" and ran a query directly against the repository db in MySQL

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Updating same attribute of multiple elements
« Reply #1 on: September 08, 2016, 11:58:13 pm »
I would probably do something like that in SQL too, but if you want to you use the API as well using a little script.

The most efficient would be to use Repository.GetElementSet() using an SQL query that returns all your tasks as parameter (second parameter should be "2")

Then loop those elements, get their parent element, copy the status of the parent element to the task element, and update the task element.

Downside of the API approach is dat it will take a lot longer to execute then the direct SQL approach, but it is of course safer then running update queries directly on the database.

Geert