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

Mats Gejnevall

  • EA User
  • **
  • Posts: 98
  • Karma: +1/-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: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • 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: +2/-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

shimon

  • EA User
  • **
  • Posts: 167
  • Karma: +5/-0
    • View Profile
Re: Avoiding deleting elements in use
« Reply #4 on: November 06, 2023, 11:41:34 pm »
Thanks PJK,
I used this search to find Data Structures that are not in use.
Searching for attributes of a struct TYPE or parameters of this TYPE is pretty straight forward. Using your search, I was able to find the places where they are used in Data Flows.

Using SQL-Server, I had to change the select to ... (description 1,38 ) ...... ( description 40,38).

You should be aware that there may be an Abstract struct which is not in use, but have derived Structs that are in use.
Sincerely,
Shimon