Author Topic: Element Usage  (Read 1012 times)

Vasuki Benhur

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Element Usage
« on: October 16, 2014, 03:33:41 am »
I can find element usage in all diagrams by selecting individual element in a diagram. Is there a way to list all elements and their usages across all diagrams? Any help appreciated.

qwerty

  • EA Guru
  • *****
  • Posts: 10812
  • Karma: +244/-220
  • I'm no guru at all
    • View Profile
Re: Element Usage
« Reply #1 on: October 16, 2014, 05:23:00 am »
Ctrl-U

q.

Vasuki Benhur

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Element Usage
« Reply #2 on: October 16, 2014, 05:26:59 am »
Crtl-U for one element. I like to list all the elements in a diagrams and thier usages in other diagrams (Like a report or link relationship matrix).
Thanks!

qwerty

  • EA Guru
  • *****
  • Posts: 10812
  • Karma: +244/-220
  • I'm no guru at all
    • View Profile
Re: Element Usage
« Reply #3 on: October 16, 2014, 05:31:19 am »
Nope. EA itself is not that OO as the things it targets :o You might send a feature request, but honestly: forget it. We asked for such things in many aspects (like for connectors) but all we get is some half cooked stuff. Either you decide to write some script/add-in or you accept your fate :-/

q.
« Last Edit: October 16, 2014, 05:31:54 am by qwerty »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6963
  • Karma: +71/-10
    • View Profile
Re: Element Usage
« Reply #4 on: October 16, 2014, 09:20:22 am »
Quote
(Like a report or link relationship matrix).
That doesn't make sense. An element will appear in every relationship matrix that targets that package (or a parent) and the same for searches that return it. You would end up with a usage list that shows at least two relationship matrices for every package in your model.
Eve

support@sparxsystems.com

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2684
  • Karma: +44/-2
    • View Profile
Re: Element Usage
« Reply #5 on: October 16, 2014, 09:41:09 am »
Quote
Quote
(Like a report or link relationship matrix).
That doesn't make sense. An element will appear in every relationship matrix that targets that package (or a parent) and the same for searches that return it. You would end up with a usage list that shows at least two relationship matrices for every package in your model.
I think he wants something that looks like a relationship matrix, but instead of Elements x Elements, it's Elements x Diagrams, with an 'X' in each cell if the element is on the diagram.
The Sparx Team
support@sparxsystems.com

Vasuki Benhur

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Element Usage
« Reply #6 on: October 16, 2014, 10:37:39 am »
Yes. Thats exaclty what I am looking for. Does any one have script to get this?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 9736
  • Karma: +286/-30
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Element Usage
« Reply #7 on: October 16, 2014, 05:04:51 pm »
I don't think anyone will have a script like that ready to use, but its not that hard to write something yourself.
You can start from a selection of elements
Then you iterate the elements and for each element you get all using diagrams, and you remember which element is used on which diagram.

Then all you need to do is somehow show/export the results.

To get you started, here's the implementation in ElementWrapper of the operation getUsingDiagrams<T> from my EA Add-in Framework

Code: [Select]
   //returns a list of diagrams that somehow use this element.
    public override HashSet<T> getUsingDiagrams<T>()
    {
        string sqlGetDiagrams = @"select distinct d.Diagram_ID from t_DiagramObjects d
                                  where d.Object_ID = " + this.wrappedElement.ElementID;
        List<UML.Diagrams.Diagram> allDiagrams = this.model.getDiagramsByQuery(sqlGetDiagrams).Cast<UML.Diagrams.Diagram>().ToList(); ; ;
        HashSet<T> returnedDiagrams = new HashSet<T>();
        foreach (UML.Diagrams.Diagram diagram in allDiagrams)
        {
            if (diagram is T)
            {
                T typedDiagram = (T)diagram;
                if (!returnedDiagrams.Contains(typedDiagram))
                {
                    returnedDiagrams.Add(typedDiagram);
                }
            }
        }
        return returnedDiagrams;
    }

geert