3

我有具有 10 个或更多标记值的元素,而不是一次删除这些值,有没有办法同时删除这些值?

4

3 回答 3

2

正如 Uffe 指出的那样,您可以使用脚本来执行此操作。有关 EA 脚本的更多信息,请参阅此处的 EA 用户指南

作为示例,这里有一个函数,用于删除 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
于 2015-04-17T07:58:41.790 回答
0

不在 GUI 中,您必须编写脚本。

标签存储在元素的TaggedValues集合中。当您删除条目时,一个提示是向后遍历集合。

于 2013-10-16T06:53:39.717 回答
0

有一个 EA 帮助页面,它确认这目前是不可能的:

要删除此属性,您必须打开元素属性对话框,转到标记值选项卡并手动删除该项目。当前没有从多个元素中同时删除标签的快捷方式。

http://www.sparxsystems.com/enterprise_architect_user_guide/10/modeling_basics/addtaggedvalues.html

于 2014-02-17T10:58:10.580 回答