Book a Demo

Author Topic: Get element that are not there in the diagram  (Read 5810 times)

sspvirgo

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Get element that are not there in the diagram
« on: July 20, 2011, 01:38:47 am »
Hi,

I want to get the collections of all elements in the diagram. In EA even if you delete the element from the diagram it still remains and shows up in the project browser.

I does not know much about querying the assocaited table what i did is
Repository.getElementset("Select * from t_object",2) i got the list of all the elements including the package. What query should i pass in order to get the elements of the diagram of their respective package and not for the whole model.

I dont know much about what information does all this tables contain so need a help to understand this so i can query the database using where clause and get desired data

Thanks,
Saddiq Prasla

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Get element that are not there in the diagram
« Reply #1 on: July 20, 2011, 05:08:34 pm »
You might want to explain a bit further what you actually need.

Geert

PS. You can open your eap file with ms-access to figure out the database layout.

sspvirgo

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: Get element that are not there in the diagram
« Reply #2 on: July 20, 2011, 11:20:31 pm »
Hi Geert,

In EA we see that the element that is being deleted from the diagram can be used again in future by dragging the element to the diagram and it remembers all the relationship. As i was new to EA earlier i was just checking the elements based on their existence on diagram but later i realized the element which are deleted still exits in the database and can be put in the diagram at later stages. So i need to get info about all elements in that diagram thats the reason i was querying the database i think it would require some where clause in it but i dont know the structure of this tables and relationship among them so i am not able to do what i need to.

Appreciate your help on this.

Thanks

Shemuel

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
  • Oh, hi there.
    • View Profile
Re: Get element that are not there in the diagram
« Reply #3 on: July 21, 2011, 02:26:52 am »
Hello,

I've just started scripting in EA so I might get things wrong, but I'll tell you what I'm able to.

I'm not sure how you'd do it with SQL but if you're using EA scripts you can tell it to use the currently selected package as a root. Then you'd iterate through its child packages and make your own collection of elements that you find. You could also gather diagrams you find and then check their objects, removing the associated elements from that collection to be left with a collection of only elements which are in the project browser but do not appear in any diagram.

Sam

P.S. This resource is what I've been using to find out attributes and methods:
http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/reference.htm
It takes some navigating to find particular pages, but finding links in the repository spec is a good start.
Using EA 9.0.908 System Engineering Edition.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Get element that are not there in the diagram
« Reply #4 on: July 21, 2011, 03:19:14 pm »
Sam,

That is indeed a correct way to work, but the downside is that it is pretty slow.
The API tends to get really slow when iterating different collections. A call to Repository.GetElementSet() with an SQL query will be a magnitude faster.

Saddiq,

I'm still not getting your requirement. You need info on all elements in a diagram that aren't on a diagram? That just doesn't make sense. :-?
Anyway, all elements in the model are stored in t_object. All elements shown on diagrams will have a record in t_diagramObjects.
So all records in t_object that don't have a (one or more) record in the t_diagramObjects are the elements that are not shown on any diagram.

Geert

sspvirgo

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: Get element that are not there in the diagram
« Reply #5 on: July 22, 2011, 12:11:58 am »
Hi Geert,

Thanks i require elements that are not there in the diagram because EA keep that element in the database so later on anyone can drag and drop the element seen in the project browser to the diagram . The reason i am doing this to let the user know that there are elements u created but are not being used in the diagram. So they can either delete it or put them back into the diagram.

I Hope you get it this time Geert, Anyways thanks once again

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Get element that are not there in the diagram
« Reply #6 on: July 22, 2011, 08:13:23 am »
Now that I know what you're trying to do. You can run the Find Orphans search. If you specifically want it as functionality of you add-in then you can use Repository.GetElementsByQuery.