Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: tonySparx on February 02, 2010, 01:44:40 am
-
Hi all,
I need to get objectType from an object ID, i.e. I have an object ID and I want to know what kind of object that is (otElement, otConnector and so on)?
I've already read the userGuide, but I suppose don't exists a method like " objectType getObjectByID(int ID)"...
Is there a way to implement my need in EA?
kind regards
Antonio
-
No, the ID isn't unique across all types.
-
Antonio,
In that case you'll need to use the GUID property.
That would be (by its nature) unique amongst all objects.
Geert
-
You do have two options in the following scenarios:
1. If it's the currently selected item you can call GetContextItemType()
2. If it's the currently selected item in the tree you can call GetTreeSelectedItemType()
-
Antonio,
In that case you'll need to use the GUID property.
That would be (by its nature) unique amongst all objects.
Geert
Thanks to all for help,
Geert, would be unique or IS unique? :D I've not found anything about this difference on the EA userguide...
-
Tony,
"should", but with EA you never know ;)
Geert
-
Antonio,
In that case you'll need to use the GUID property.
That would be (by its nature) unique amongst all objects.
Geert
Thanks to all for help,
Geert, would be unique or IS unique? :D I've not found anything about this difference on the EA userguide...
As a Data Architect, Tony, I learnt a LONG time ago that the term unique MUST always be accompanied by the context in which one is asserting uniquenesss...
For example, within a table such as t_object, the Object_ID is unique, but not across tables. A GUID or UUID is notationally unique but only if you don't assign it to more than one entity.
Personally, I'd probably create a t_GUID table that had the GUID as the primary key, then the entity type (it was assigned to), and the entityID. That way, I'd end up with a self-consistency mechanism that would assist in ensuring I didn't allocate the same GUID to more than one entity (not that, so far, EA does).
HTH,
Paolo