Author Topic: Avoiding deleting elements in use  (Read 821 times)

Mats Gejnevall

  • EA User
  • **
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Avoiding deleting elements in use
« on: December 14, 2017, 03:25:00 am »
Hi all
I want to clean up my database of elements not in use. I use the Find orphan function and it lists a lot of elements not in use. But many of them are used in my information flows. Is there a way of detecting which orphaned elements are used in information flows? Or is there a configuration where they would not show up in that list?

Thanks Mats

qwerty

  • EA Guru
  • *****
  • Posts: 9668
  • Karma: +176/-150
  • I'm no guru at all
    • View Profile

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8470
  • Karma: +207/-26
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Avoiding deleting elements in use
« Reply #2 on: December 14, 2017, 06:00:12 pm »
This search might help a bit, although it doesn't include conveyed items yet
https://bellekens.com/2015/10/16/searching-for-real-orphans-in-enterprise-architect/

Geert

PJK

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
  • Transmisi me sursum, Caledoni
    • View Profile
Re: Avoiding deleting elements in use
« Reply #3 on: January 24, 2018, 02:42:23 am »
Finding conveyed elements for information flows is messy - this clearly was added after the EA data model ossified. Here is a search that will tell you the source, target and flows conveying an element identified by its GUID:
SELECT Distinct o.ea_guid as CLASSGUID, o.Object_Type as CLASSTYPE, o.name As Source, c.name as Flow, trg.name as Destination

FROM t_object o, t_object trg, t_xref x, t_connector c
WHERE
'<Search Term>' IN (
#DB=SQLSVR#s substring(x.description,0,39), substring(x.description,39,39), substring(x.description,78,39), substring(x.description,117,39), substring(x.description,156,39), substring(x.description,195,39), substring(x.description,234,39),
substring(x.description,273,39), substring(x.description,312,39),substring(x.description,351,39)
#DB=SQLSVR#
#DB=Other#
left(x.description,38), mid(x.description,40,38), mid(x.description,79,38), mid(x.description,118,38), mid(x.description,157,38), mid(x.description,196,38), mid(x.description,235,38), mid(x.description,274,38), mid(x.description,313,38), mid(x.description,352,38)
#DB=Other#
)
AND x.Behavior = 'conveyed'
AND c.ea_guid = x.Client
AND o.object_id = c.Start_Object_ID
AND trg.object_id = c.End_Object_ID

order by o.name

You can write a simple script to get the element GUID from the project browser or a diagram, then call the search, or just copy/paste the GUID into the search parameter.
Cheers, Phillip