【发布时间】:2013-10-15 18:15:20
【问题描述】:
我的元素有 10 个或更多标记值,而不是一次删除这些值,有没有办法同时删除它们?
【问题讨论】:
我的元素有 10 个或更多标记值,而不是一次删除这些值,有没有办法同时删除它们?
【问题讨论】:
正如 Uffe 指出的那样,您可以使用脚本来执行此操作。有关 EA 脚本的更多信息,请参阅the EA User Guide here。
作为一个例子,这里有一个函数,用于删除 VBScript 中单个元素上按名称标记的所有实例:
function deleteTaggedValueForElement( theElement, theTagName )
dim i
if not theElement is nothing and Len( theTagName ) > 0 then
dim tags as EA.Collection
set tags = theElement.TaggedValues
for i = tags.Count - 1 to 0 step -1
dim theTag as EA.TaggedValue
set theTag = tags.GetAt( i )
if theTag.Name = theTagName then
call theElement.TaggedValues.DeleteAt( i, FALSE )
end if
next
end if
end function
sub main
dim theTagName
dim theQuery
dim theElements as EA.Collection
theTagName = "MyTag"
theQuery= "SELECT t_object.Object_ID FROM t_objectproperties INNER JOIN t_object ON t_objectproperties.Object_ID = t_object.Object_ID WHERE t_objectproperties.Property='" & theTagName & "'"
set theElements = Repository.GetElementSet( theQuery, 2 )
dim theElement
for each theElement in theElements
call deleteTaggedValueForElement( theElement, theTagName )
next
end sub
main
【讨论】:
不在 GUI 中,您必须编写脚本。
标签存储在元素的TaggedValues 集合中。当您删除条目时,有一个提示是向后遍历集合。
【讨论】:
有一个 EA 帮助页面,确认目前无法实现:
要删除此属性,您必须打开元素属性对话框, 转到标记值选项卡并手动删除该项目。有 目前没有从多个元素中删除标签的快捷方式 同时。
http://www.sparxsystems.com/enterprise_architect_user_guide/10/modeling_basics/addtaggedvalues.html
【讨论】: