Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Alexander.Golyshkin on December 25, 2023, 07:24:24 pm
-
Does exist any object API (Project/Repository/etc) for for "find in all diagrams" element by it's GUID?
-
Not directly.
First do a Repository.SQLQuery for the diagramID's, and then get the diagrams from their ID
Geert
-
I made me a SQL to find any guid inn almost anything. Actually I used it in a script to show the result directly in the browser.
q.
-
OK, I understood that there is no specific object API for that. So, could you help me to make a SQL query which will find any diagrams GUIDs in model where contain a specific GUID element?
-
I just did a couple experiments and found that EA supports a nested SQL queries, so
// Getting count usages in diagrams for object_guid = {453E455C-AD5D-49a4-8EF5-851ADA1BAD37}
SELECT COUNT(*) from t_diagramobjects where object_id= (SELECT object_id from t_object WHERE ea_guid='{453E455C-AD5D-49a4-8EF5-851ADA1BAD37}')
-
I just did a couple experiments and found that EA supports a nested SQL queries, so
// Getting count usages in diagrams for object_guid = {453E455C-AD5D-49a4-8EF5-851ADA1BAD37}
SELECT COUNT(*) from t_diagramobjects where object_id= (SELECT object_id from t_object WHERE ea_guid='{453E455C-AD5D-49a4-8EF5-851ADA1BAD37}')
I don't think that's the most efficient way to do that.
I would use
select d.Diagram_ID from t_diagram d
where exists
(select do.Instance_ID from t_diagramobjects do
inner join t_object o on o.Object_ID = do.Object_ID
where do.Diagram_ID = d.Diagram_ID
and o.ea_guid = '{6202126E-1F87-4f99-9A80-BABCC305BC6F}')
Geert