Book a Demo

Author Topic: Dependency mapping from spreadsheet  (Read 6016 times)

Octavian

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Dependency mapping from spreadsheet
« on: April 18, 2012, 03:24:13 am »
Hello all! I was hoping you could help me with a situation:

1. I have an excel table with 5 columns and about 200 rows. The columns are as follows:
A = Component 1
B = Type of Interface
C = Component 2
D = Interface name
E = A note
F = Output

2. I have to create a dependency diagram using any tool - but I want to do it in EA since it's easier to maintain later.
3. I want to include all columns but the last two can be omitted if necessary.

Any ideas? Can I import these somehow and have the lines "draw themselves"? Last thing I want to do is do this whole thing manually.  :'(

Cheers,
Octavian
« Last Edit: April 18, 2012, 03:25:21 am by opetrescu »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Dependency mapping from spreadsheet
« Reply #1 on: April 18, 2012, 04:29:32 am »
You can do this 'quite eaily' using EA's API. Have a look at the scripting view. It's a little effort but pays off for later.

q.

Octavian

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Dependency mapping from spreadsheet
« Reply #2 on: April 18, 2012, 04:30:57 am »
Interesting. Any specific section in EA's API? Right now I'm trying to import via CSV...

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Dependency mapping from spreadsheet
« Reply #3 on: April 18, 2012, 04:59:35 am »
I'm afraid CSV import will not be able to create the references. What you need to to is in short:
Code: [Select]
pk = repos.GetTreeSelecetdObject() # highlighted package in browser
for each row
  c1 = pk.Elements.Addnew (col1, "Component")
  # you might have a local lookup for duplicates
  c1.Update
  c2 = pk.Elements.Addnew (col3, "Component")
  c2.Update
  # now I don't know how you will handle your interfaces but to make it simple
  con = c1.Connetors.Addnew("", "Association")
  con.clientId = c2.ElementId
  con.update() # link c1-c2 via association
end
Hope that gives an idea. There are quite some example scripts you can take as a start (VB and JScript).

q.
« Last Edit: April 18, 2012, 05:01:11 am by qwerty »

Octavian

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Dependency mapping from spreadsheet
« Reply #4 on: April 18, 2012, 05:28:03 am »
OK. I can definitely understand the code but I'd need a primer on how to use the API. Never done it before. I'll do some searches.

Any alternatives?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Dependency mapping from spreadsheet
« Reply #5 on: April 18, 2012, 06:20:21 am »
Until someone else comes up with a better solution (CSV import might have improved since I last used it) you should look into View/Scripting. The samples are a good start.

q.

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Dependency mapping from spreadsheet
« Reply #6 on: April 18, 2012, 01:06:50 pm »
The old problem of should I manually do it or spend some time automating it aye?

To help you work out what its going to look like I suggest you model one example so you understand how your model will look. For instance there are two ways you can model an interface. One attached to a component and the other is as a separate object.

If you have VBScript or JScript skills then suggest writing a script that parses your CSV file and creates the components, interfaces etc.
There are plenty of example scripts and you'll have to search the forum for examples on creating relationships

Once your script has successfully imported the components, interfaces and relationships then you can drag the components onto a diagram to draw up. Alternatively in your script you can make your script a bit more complex and create diagrams too.

Think this would probably take me around half a day to write, test and fix any bugs. So assuming you could do it in the same time the question is would it be quicker doing it manually? I would be tempted to resort to doing it manually if it was a one off job and there 100 or less entries in that original files. If on the other hand your going to do this more than once then definitely go down the automation process.

Well hope that helps.
Happy to help
:)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Dependency mapping from spreadsheet
« Reply #7 on: April 18, 2012, 03:28:42 pm »
You could also have a look at the simple vba excel importer I uploaded on the community site.
That should give you a jump start as it already reads an excel file and creates and/or updates stuff in EA.

Geert

Octavian

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Dependency mapping from spreadsheet
« Reply #8 on: April 18, 2012, 11:40:39 pm »
Thank you sir! I will give it a try. Lovin the support! Cheers!