Book a Demo

Author Topic: Retrieve the EA version and build number during report generation  (Read 20603 times)

marc.zeller

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Dear all,

is there a possible to get the version and build number of the EA version used to generate a report? Or can the EA version be retrieved programmatically in an add-in?

Regards,
Marc

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1349
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Retrieve the EA version and build number during report generation
« Reply #1 on: October 26, 2025, 09:18:07 am »
Yes, you can retrieve the version and build number of Sparx Enterprise Architect using JavaScript via the `Repository` object.

To do this, use the `Repository.GetEAEdition()` and `Repository.LibraryVersion` properties. Here's how it works:

Accessing EA Version and Build in JavaScript
Sparx EA’s scripting environment exposes a `Repository` object that provides metadata about the running instance. You can use the following script:

Sample javascript
Code: [Select]
!INC Local Scripts.EAConstants-JavaScript

function GetEAVersionInfo() {
    var edition = Repository.GetEAEdition();       // e.g., "Corporate Edition"
    var version = Repository.LibraryVersion;       // e.g., "1713"

    Session.Output("EA Edition: " + edition);
    Session.Output("EA Version and Build: " + version);
}

GetEAVersionInfo();
```

Explanation
- `Repository.GetEAEdition()`- returns the edition name (e.g., Corporate, Ultimate).
- `Repository.LibraryVersion`- returns the full version string including the build number (e.g., `1713` means version 17.1, build 1713).
- `Session.Output()`- prints to the script console, useful for debugging or logging.

Use Case in Reporting
If you're generating a report and want to include the EA version/build for traceability or compliance, you can:
- Embed this script in a report template.
- Store the version string as a tagged value or note on a model element.
- Include it in a custom document section via scripting.

« Last Edit: October 30, 2025, 06:03:08 am by Sunshine »
Happy to help
:)

Elpis

  • EA User
  • **
  • Posts: 64
  • Karma: +7/-0
  • Make MDA/MBSE vital.
    • View Profile
Re: Retrieve the EA version and build number during report generation
« Reply #2 on: October 30, 2025, 01:19:26 am »
- `Repository.LibraryVersion`- returns the full version string including the build number (e.g., `17.1.1629` means version 17.1, build 1629).

In my EA 17.1.1713, Repository.LibraryVersion returns only a build number (1713). And this is what the documentation says, as well.

BTW A "17.1.1629" example is impossible - build number always starts with major+minor version number.
« Last Edit: October 30, 2025, 01:22:57 am by Elpis »

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1349
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Retrieve the EA version and build number during report generation
« Reply #3 on: October 30, 2025, 06:04:28 am »
Yes you are quite right I'd copied some code but forgot to properly update the comments. I've correct that now.
Anyways I hope the example code helps you get done what you needed.
Happy to help
:)