Author Topic: In which SQL table can I find the Child Diagram Links?  (Read 1393 times)

wivel

  • EA User
  • **
  • Posts: 243
  • Karma: +12/-1
  • Driven by Models
    • View Profile
In which SQL table can I find the Child Diagram Links?
« on: May 24, 2024, 12:12:53 am »
Hi

As the Subject says  :). Couldn't find anything when searching the forum.

In short, I need to find the the elements a certain diagram is linked to in order to clean-up an EA model.

Henrik 

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: In which SQL table can I find the Child Diagram Links?
« Reply #1 on: May 24, 2024, 12:23:53 am »
This is how I get the elements that use a diagram as composite diagram See https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework/blob/master/EAAddinFramework/EAWrappers/Diagram.cs

Code: [Select]
        /// <summary>
        /// The elements that have this diagram as composite diagram
        /// </summary>
        public HashSet<UML.Classes.Kernel.Element> compositeElements
        {
            get
            {
                HashSet<UML.Classes.Kernel.Element> results = new HashSet<TSF.UmlToolingFramework.UML.Classes.Kernel.Element>();
                string sqlGet = " select o.Object_ID from t_object o                          " +
                                " where o.PDATA1 = '" + this.DiagramID.ToString() + "'           " +
                                " and o.Object_Type <> 'Package'                              " +
                                " union                                                       " +
                                " select o.Object_ID from t_object o                          " +
                                " inner join t_xref x on o.ea_guid = x.Client                 " +
                                " where x.Supplier = '" + this.diagramGUID + "'                ";
                foreach (ElementWrapper element in this.model.getElementWrappersByQuery(sqlGet))
                {
                    results.Add(element);
                }
                return results;
            }
        }

Geert

wivel

  • EA User
  • **
  • Posts: 243
  • Karma: +12/-1
  • Driven by Models
    • View Profile
Re: In which SQL table can I find the Child Diagram Links?
« Reply #2 on: May 24, 2024, 12:28:45 am »
Thanks Geert. Really appreciate it.

Henrik