Book a Demo

Author Topic: Automate export CSV in VBScript  (Read 6153 times)

FrankStanssens

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Automate export CSV in VBScript
« on: October 18, 2018, 11:13:41 pm »
Hi,

I'm using VBScript to automate some documentation generation.
One of the actions I want is to export to CSV using a created CSV Specification. (manually by using menu Package - Import/Export - CSV Import/Export)
Can anyone point me in the right direction to do this with VBScript?

Thanks in advance,

Frank

Arshad

  • EA User
  • **
  • Posts: 291
  • Karma: +21/-1
    • View Profile
Re: Automate export CSV in VBScript
« Reply #1 on: October 18, 2018, 11:27:43 pm »
FYI

You can try this Sparx MDG for Microsoft Office Tools ( Excel Exporter )

Excel Export allows users to publish Enterprise Architect model contents including elements, connectors, tagged values, attributes and operations, as Excel Workbooks. Users also have the flexibility to generate the model contents to a pre-formatted Excel worksheet.It can be used to sync back excel contents with EA.

HTH
Arshad

« Last Edit: October 18, 2018, 11:34:26 pm by Arshad »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Automate export CSV in VBScript
« Reply #2 on: October 18, 2018, 11:31:42 pm »
There is no way to use the CSV export/import definitions from scripting.

What you can do is write your own import/export routine. It is really not that difficult.

I have a couple of export script in my VBScript library: https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library

Geert

FrankStanssens

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Automate export CSV in VBScript
« Reply #3 on: October 18, 2018, 11:48:31 pm »
Hi Geert,

Thank you for your quick answer

What a pitty! I already automated HMTL reporting by RunHTMLReport. Thought I could do the CSV export the same way.
Guess it isn't possible using C# neither?

I would actually want to use that specification, so when someone exports manually or by script the result would be the same

Greetings,

Frank

« Last Edit: October 18, 2018, 11:58:45 pm by FrankStanssens »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Automate export CSV in VBScript
« Reply #4 on: October 18, 2018, 11:57:32 pm »
C# and VBscript use the same API, so no  :-\

Geert

FrankStanssens

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Automate export CSV in VBScript
« Reply #5 on: October 19, 2018, 02:01:42 am »
Ok, trying it the hard way lol

is there a way you can get an element property by name, like myElement.GetPropertyByName("GUID")

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Automate export CSV in VBScript
« Reply #6 on: October 19, 2018, 04:04:49 am »
Not really.
You can either use the API like myElement.ElementGUID (see https://www.sparxsystems.com/enterprise_architect_user_guide/14.0/automation/reference.html for an API reference) or you can use Repository.SQLQuery() to get your data as a set.

I would probably go for the latter in case of an export. There is a huge difference in performance between the two.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Automate export CSV in VBScript
« Reply #7 on: October 19, 2018, 07:51:31 am »
Not to forget Repository.GetElementsByQuery.

q.

FrankStanssens

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Automate export CSV in VBScript
« Reply #8 on: October 19, 2018, 05:09:47 pm »
ok. Thank you all for your help

Frank