Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: marc.zeller on October 26, 2025, 05:35:48 am
-
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
-
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
!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.
-
- `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.
-
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.