Importing relationships from Excel

376 views
Skip to first unread message

PhilBennett1

unread,
May 12, 2015, 11:15:08 PM5/12/15
to sparx-enterprise-archite...@googlegroups.com
Hi,

It seems to be a hot topic and I have found various pieces of the puzzle of importing relationships from Excel however does anyone actually have the code used to do so that I could please have?

I have a script working that will update the t_connector table with new rows however advice from various people (including Geerts) is to not do it that way. Unfortunately then I hit the wall of my technical capabilities and have been unable to create a whole script that will import my relationships.

Thanks in advance!

[original message]

smendonc

unread,
May 13, 2015, 1:27:01 AM5/13/15
to sparx-enterprise-archite...@googlegroups.com
There is a complete script to create a relationship (connector) in the help at /Automation and Scripting/Enterprise Architect Object Model/Reference/Code Samples/Add a Connector.  

The MDG Office Integration that Sparx just released will allow you to do this as will EADocx.

[original message]

Bellekens@localhost Geert Bellekens

unread,
May 13, 2015, 1:56:57 AM5/13/15
to sparx-enterprise-archite...@googlegroups.com
Adding a relation to an element using the API is actually quite simple.

You need

- SourceElement as EA.Element
- TargetElementID as Long
- ConnectorType as String

Then you do can call a method like this one:

Code:
function addConnector (SourceElement, TargetElementID,ConnectorType)
     dim NewConnector as EA.Connector
     'Create the new connector at the source element
     set NewConnector = SourceElement.Connectors.AddNew("name or empty string", ConnectorType)
     'Set the target element
     NewConnector.SupplierID = TargetElementID
     'Save the connector
     NewConnector.Update
     'Return the connector
     set addConnector = NewConnector
end function


Geert

[original message]

MrWappy

unread,
May 13, 2015, 3:36:00 AM5/13/15
to sparx-enterprise-archite...@googlegroups.com
For completeness eaDocX can also import relationships from Excel.
Go to EaDocX.com for a trial version which gives you 30days to check out if it does what you want!

[original message]

Nabil

unread,
May 13, 2015, 7:55:25 AM5/13/15
to sparx-enterprise-archite...@googlegroups.com
Hi PhilBennett1,

Try MDG Office Integration from Sparx Systems to import data from excel which will allow to import relationships and elements also set stereotypes to the elements

download MDG office integration from the below link: http://sparxsystems.com/products/mdg/int/office/office-integration.html

i hope this will simplify your task  :)

Thanks,
Nabil

[original message]

swc

unread,
May 13, 2015, 8:37:05 AM5/13/15
to sparx-enterprise-archite...@googlegroups.com
We provide a platform that will handle relationship importing for data from target sources - see this link:
http://www.aprocessgroup.com/products/apg-modelflow/

[original message]

PhilBennett1

unread,
May 13, 2015, 7:55:15 PM5/13/15
to sparx-enterprise-archite...@googlegroups.com
Thank you all.

I managed to get the following code to work based on Geerts example.
Code:
function addConnector(SourceElementID,TargetElementID,ConnectorType)

     dim SourceElement
     dim NewConnector as EA.Connector
     Set SourceElement = Repository.GetElementByID(SourceElementID)

     
     'Create the new connector at the source element
     set NewConnector = SourceElement.Connectors.AddNew(" ", ConnectorType)

     
     'Set the target element
     NewConnector.SupplierID = TargetElementID
     'Extra fields below if need be
     'NewConnector.Stereotype = "RequirementRelated"
     'NewConnector.Direction = "Source -> Destination"

     'Save the connector
     NewConnector.Update
     'Return the connector
     set addConnector = NewConnector
end function

'this is our main function, that we will call the function with the required fields
Sub Main
   Call addConnector(49201,49203,"Realization")
End Sub

[original message]
Reply all
Reply to author
Forward
0 new messages