Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Ceronimo on April 15, 2016, 08:10:45 pm
-
Hi
at firs i gave some elements ataggedvalue "isRegistred".
Now i want to see after an Event which Elements have this tag !
I know how to get a tag of the element,
but i don`t know how to get all Elements
and in a Routine then i want to check all elements if they have These tagged value.
1. How can i save all Elements in the open Project in EA.Element[] Array ??
2. The id of aRoot i only can get with parentid not with package id , i have wrote a recursive Routine,
which should find the Root but i always get a Message id not found, if i hardcode it i only can get it with parentid ?
-
Note:
I already tried to get the Elements with
EA.Collection aCollection=getElementSets(null,0);
EA.Element aElement=aCollection.getat(x);
but it doesnt work !
-
You don't want to go and check each element in your model, that will take forever.
Better be clever and only get those that have that specific tagged value.
GetElementSet can also be used with an SQL query that returns the ObjectID's.
So you use it as follows
string SQLQuery = @"select o.Object_ID from (t_object o
inner join t_objectproperties tv on tv.Object_ID = o.Object_ID)
where tv.Property = 'isRegistered'";
EA.Collection allRegisteredElements = Repository.GetElementSet(SQLQuery, 2);
Geert
-
thank you geert it worked again, like always
;D ;D ;D ;D