Reputation: 71
I have a UML diagram and all the component has tagged values . I would like to retrieve the tagged value with the element name . Something like this to get the tagged value that i have code but dont know how to start it for a diagram.
function TVGetElementTaggedValue( theElement, taggedValueName, defaultValue )
TVGetElementTaggedValue = defaultValue
if not theElement is nothing and Len(taggedValueName) > 0 then
dim taggedValue as EA.TaggedValue
set taggedValue = theElement.TaggedValues.GetByName( taggedValueName )
if not taggedValue is nothing then
TVGetElementTaggedValue = taggedValue.Value
end if
end if
end function
Upvotes: 1
Views: 2438
Reputation: 71
Finally Here is the solution that i have and it worked finally:
Repository.GetTreeSelectedItemType() = otDiagram
Roles = TVGetElementTaggedValue(element, "Roles", "", "")
Function TVGetElementTaggedValue( theElement, taggedValueName, defaultValueMissing, defaultValueEmpty )
if not theElement is nothing and Len(taggedValueName) > 0 then
dim taggedValue as EA.TaggedValue
set taggedValue = theElement.TaggedValues.GetByName( taggedValueName )
if taggedValue is nothing then
TVGetElementTaggedValue = defaultValueMissing
' Dump warning
'Session.Output(theElement.Name & " " & taggedValueName & " TAG Missing")
else
if taggedValue.Value = "" then
TVGetElementTaggedValue = defaultValueEmpty
' Dump warning
'Session.Output(theElement.Name & " " & taggedValueName & " Value Missing")
else
TVGetElementTaggedValue = taggedValue.Value
end if
end if
end if
end function
Session.Output("Roles: " + CStr(Roles))
Thank you for the help.
Upvotes: 1