Book a Demo

Author Topic: Bulk change of relationships  (Read 5839 times)

Michel777

  • EA User
  • **
  • Posts: 228
  • Karma: +0/-0
    • View Profile
Bulk change of relationships
« on: October 13, 2013, 07:02:34 am »
Hi,

there is  70 use cases, 100 components and 500 relationships between them ( trace). Sometimes in both directions .

Question: how to change the relationship  "trace" into "association" ?

Thanks,

Michel

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Bulk change of relationships
« Reply #1 on: October 13, 2013, 08:36:39 am »
You should do that with a SQL like
Code: [Select]
UPDTAE t_connector SET connector_type = "Dependency", stereotype = "trace" WHERE connector_type = associationif it's only relevant associations. Eventually you could export a package with only the elements you want to change, import them in a temp model, run the SQL, and ex-/import them back.

q.

motivatedgorilla

  • EA User
  • **
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: Bulk change of relationships
« Reply #2 on: February 13, 2014, 12:15:32 pm »
I thought we couldn't run UPDATE from within Sparx

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Bulk change of relationships
« Reply #3 on: February 13, 2014, 06:39:39 pm »
You can execute an update statement either directly on the database, or via a script using the hidden operation Repository.Execute(String sqlQuery)

Geert

PS. Be careful with that. It is very easy to completely f*ck up your model this way ;D

Sorno

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
    • View Profile
Re: Bulk change of relationships
« Reply #4 on: February 15, 2014, 01:42:53 am »
Might not be as neat, but if SQL is too daring - why don't script it?

I have found it very useful to have a basic script that can run through a complete model or certain package and apply some kind of a fix on each element/connector matching some criteria.

If it's a one-time thing the speed of the script dosn't feel like such a big deal.