1
Automation Interface, Add-Ins and Tools / Re: Finding Operation-associated Actions
« on: February 24, 2012, 09:05:58 am »
Great, thanks!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
public object getRequirementsList(EA.Repository repo, object arghs)
public string getRequirementsList(EA.Repository repo, string[] args)
public object getRequirementsList(EA.Repository repo, object arghs)
$reqs = %EXEC_ADD_IN("My Addin", "getRequirementsList", opGUID)%
"SELECT TagValue FROM t_taggedvalue WHERE ElementID = <<requirement_element_id>>;"
"SELECT * FROM t_taggedvalue;"
I only get a few hundred results. Given that there are a few thousand requirements which all have 10+ taggedvalues associated with them this can't be right, so what am I doing wrong? When I rebuild the tags like so:EA.Element currReq = (EA.Element)Repository.GetElementByID(objID);
EA.Collection tags = (currReq.TaggedValues);
EA.TaggedValue tag = (EA.TaggedValue)tags.GetByName("Status");
Dim NewElement, AddingElement, NewConnectors, NewConn
Set NewElement = GetElementByGuid("{6DFB6497-AAE6-4a9f-90CE-2F86F8E9D542}")
c.SupplierID = NewElement.ElementID
NewConnectors = NewElement.Connectors
NewConn = NewConnectors.AddNew(c.Name, "Dependency")
NewConn.SupplierID = NewElement.ElementID
NewConn.ClientID = c.ClientID
NewConn.Stereotype = "deriveReqt"
NewConn.Update
Set AddingElement = Elements.AddNew(NewElement.Name, "")
AddingElement.ElementID = NewElement.ElementID
AddingElement.Update()
GetProjectInterface().LayoutDiagramEx Diagram.DiagramGUID, EA.ConstLayoutStyles.lsDiagramDefault, 8, 50, 50, true
ReloadDiagram(Diagram.DiagramID)
option explicit
'!INC Local Scripts.EAConstants-VBScript
sub main
Dim CurrentElement
Dim i, DiagramIDs
Set CurrentElement = GetContextObject
DiagramIDs = FindInDiagrams(CurrentElement)
If UBound(DiagramIDs) > 0 Then
Session.Output CurrentElement.Type & " '" & CurrentElement.Name & "' appears on " & UBound(DiagramIDs) & " diagrams."
For i = 1 To UBound(DiagramIDs)
Dim Diagram, id
id = DiagramIDs(i)
Set Diagram = GetDiagramByID(id)
Session.Output "Diagram #" & i & ": " & Diagram.Name
Next
Else
Session.Output CurrentElement.Type & " '" & CurrentElement.Name & "' does not appear on any diagrams."
End If
end sub
'returns array of diagram ids where diagram contains the specified element
Function FindInDiagrams(Element)
Dim sql, xml, ids(), count
Dim doc, rows, row
Set doc = CreateObject("MSXML2.DOMDocument")
sql = "SELECT Diagram_ID FROM t_diagramobjects WHERE Object_ID = " & Element.ElementID
xml = SQLQuery(sql)
count = 0
ReDim ids(0)
If doc.loadXML(xml) Then
Set rows = doc.selectNodes("//EADATA//Dataset_0//Data//Row")
For Each row In rows
count = count + 1
redim preserve ids(count)
ids(count) = row.selectSingleNode("Diagram_ID").Text
Next
End If
FindInDiagrams = ids
End Function
main
I think you've missed a semi-colon...Quotediagram.StyleEx = "ShowNotes=1[highlight];[/highlight]";
diagram.Update();
diagram.StyleEx = "ShowNotes=1";
diagram.Update();