Book a Demo

Author Topic: CSV Import  (Read 3845 times)

ggandhi

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
CSV Import
« on: March 05, 2014, 04:02:51 am »
I downloaed Geert Belleken's simple-vba-excel-to-ea-importer-v3 and ran the import macro. The following code caused an error

Set parentPackage = eaConn.getSelectedPackage()

This code causes the error
Run-time error '429': ActiveX component can't create object

I realised that I need to open a Sparx EA project and select a package before running the macro. I can already import CSV to simple nodes using the standard Sparx CSV import function.  I can already use JScript in Sparx to convert the imported simple nodes to stereotyped nodes with tagged values and parts. I am struggling to understand the benefit of the Geert Belleken's VBA macro. My requirement is to import CSV files without opening the Sparx EA GUI. I need to create an executable that reads CSV files, performs calls to the Automation Interface and updates Sparx EA repository, via the Sparx Object Model. Any ideas?  How about C#?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: CSV Import
« Reply #1 on: March 05, 2014, 06:20:12 am »
You can (must) create an EA instance via OLE. That will do the trick.

q.

ggandhi

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: CSV Import
« Reply #2 on: March 07, 2014, 10:16:29 pm »
I have successfully imported an ADDM discovery CSV file into my Sparx EA Repository using a VB macro based on Geert Bellekens' VB Class Module EAConnector and VB Function addOrUpdateElement. The result is a series of temp_nodes (one per CSV row), with a tagged value holding the data from each column in the source CSV file. The tagged value names are identical to the the column headings in the source data file, so this VB macro is a Generic Data Load Tool. After the import of temp_nodes into the EA Repository, my Sparx JScript reads the temp_nodes and performs a range of business logic functions to build correctly stereotyped Nodes, with Parts (e.g. Network_Interfaces), Tagged Values etc.

I am very grateful to Nizam Mohamed and Geert Bellekens. However my manager wants me to move the non-generic business logic functions out of Sparx into a separate module e.g. C#.

Question: Do you have any C# examples of Geert's VB Class Module EAConnector, VB Class Module ExcelConnector and VB Function addOrUpdateElement?