Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: SystemsTinkerer on February 21, 2022, 12:07:24 am

Title: using Javascript/VBscript to query/modify my Model
Post by: SystemsTinkerer on February 21, 2022, 12:07:24 am
Hi EA Users,

Hope all is well on your sides!

I am trying to get started using any programming language (VB, JavaScript, C++ or Java) to start developing more complex queries than SQL route offers and eventually to modify the model elements via this code. I think (not 100% certain) the class Repository and its's methods are central to developing any interacting code:
https://sparxsystems.com/enterprise_architect_user_guide/15.2/automation/repository3.html

Please, can someone guide me on how to get started here? @Geert had suggested using the "built-in scripting module" so towards this I tried consulting his webpage:
https://bellekens.com/2015/12/27/how-to-use-the-enterprise-architect-vbscript-library/
Here, I have downloaded his example code, and then got stuck on the next step of importin the code into EA: "After downloading the file select menu option Project|Data Management|Import Reference Data and choose the downloaded file. Make sure to select Automation scripts and click Import." I could not find in EA, the menu options stated here.

Please help me to write a basic Javascript or any other language code to query and modify my model.

Many thanks for your consideration.

Best,
Oz
Title: Re: using Javascript/VBscript to query/modify my Model
Post by: Geert Bellekens on February 21, 2022, 02:20:20 am
Import Reference Data can now be found at Configure | Model | Transfer | Import Reference Data

There is a search field on the very top that you can use to search functions like this.

I have to use that myself on a regular basis since functions seem to migrate to new places every release.

Geert
Title: Re: using Javascript/VBscript to query/modify my Model
Post by: SystemsTinkerer on February 21, 2022, 03:53:01 am
Import Reference Data can now be found at Configure | Model | Transfer | Import Reference Data

There is a search field on the very top that you can use to search functions like this.


Geert

Thank you Geert! I did get to this point but upon clicking Import Reference Data I only get the option of importing "*.xml", but the folder of VBscript "Enterprise-Architect-VBScript-Library-master" does not contain any xml file type to import. How do I import the VBscrip code into EA and how do I run it?

Thanks again!
Title: Re: using Javascript/VBscript to query/modify my Model
Post by: Geert Bellekens on February 21, 2022, 03:58:11 am
The xml file can be downloaded from the page you mentioned:

https://bellekens.com/2015/12/27/how-to-use-the-enterprise-architect-vbscript-library/ (https://bellekens.com/2015/12/27/how-to-use-the-enterprise-architect-vbscript-library/)

Geert
Title: Re: using Javascript/VBscript to query/modify my Model
Post by: SystemsTinkerer on February 21, 2022, 05:02:27 am
Hi Geert,

Thank you, that worked for me. The XML file is absolutely massive, so this is what guides EA to create a Script Management package and VBScript in the correct location, right? Isn't there a much simpler way of creating scripts and using them or one has to use the XML files? It would be good to know a much simpler route to get started with.

Thanks,
Oz
Title: Re: using Javascript/VBscript to query/modify my Model
Post by: Geert Bellekens on February 21, 2022, 04:32:19 pm
You can manually create scripts, or use my loadScripts script to load scripts from .vbs files.

But other then that the xml import is the way to go. If you are looking for a way to manipulate these xml files, see https://github.com/GeertBellekens/EARefDataSplitter/releases (https://github.com/GeertBellekens/EARefDataSplitter/releases)

Geert
Title: Re: using Javascript/VBscript to query/modify my Model
Post by: SystemsTinkerer on February 22, 2022, 04:20:52 am
Cheers Geert - thanks for pointing out the other routes!

Best,
Oz