Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: vkc1020 on September 06, 2019, 06:11:18 am

Title: Accessing the versions of a diagram through API
Post by: vkc1020 on September 06, 2019, 06:11:18 am
Is there a way to find out if a given diagram has multiple versions of itself in the repository through API?

The one way I thought of accessing the package which 'owns' this diagram and iterating through its diagrams to see if there ones with the same name and with a different version (diagram.Version). But this I figured would be inefficient and would like to know if there is a more direct approach to checking if there are multiple versiosn fo the diagram API-wise.

Thank You
Title: Re: Accessing the versions of a diagram through API
Post by: qwerty on September 06, 2019, 07:02:16 am
How can a diagram have different versions of itself at all??

q.
Title: Re: Accessing the versions of a diagram through API
Post by: Paolo F Cantoni on September 06, 2019, 08:12:55 am
How can a diagram have different versions of itself at all??

q.
Well, Sparx has provided a version field for the Diagram item.  So, I guess, by definition, multiple diagrams with the same name but different version field values are "Different versions of the same diagram"  (Notwithstanding that their content may be wildly different)  ;).

Happy Friday everyone!

Paolo
Title: Re: Accessing the versions of a diagram through API
Post by: Geert Bellekens on September 06, 2019, 01:46:15 pm
The API has an operation Repository.SQLQuery that you can use for things like this.

Geert
Title: Re: Accessing the versions of a diagram through API
Post by: vkc1020 on September 06, 2019, 05:37:32 pm
Thank you Geert!

Is there a link to how to frame this query? Or a Sparx Systems documentation that has information on all the parameters in in the different SQL Tables for an Enterprise Architect Model?

Thank You!
Title: Re: Accessing the versions of a diagram through API
Post by: Geert Bellekens on September 06, 2019, 06:17:54 pm
There are plenty of examples in my code:

- VBScript: https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/search?q=SQLQuery&unscoped_q=SQLQuery (https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/search?q=SQLQuery&unscoped_q=SQLQuery)
- C# https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework/search?q=SQLQuery&unscoped_q=SQLQuery (https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework/search?q=SQLQuery&unscoped_q=SQLQuery)

And there's qwerty's book about the database structure:https://leanpub.com/InsideEA (https://leanpub.com/InsideEA)

Geert
Title: Re: Accessing the versions of a diagram through API
Post by: vkc1020 on September 07, 2019, 05:19:29 am
Thank you Geert!

As per resources online, I tried accessing the SQL Table within EA, but the Search bar in the SQL Scratch Pad is greyed out / disabled for some reason.
Do you have any idea if I should be changing some settings to enable this search feature ? I could not find much online.

Thank You
Title: Re: Accessing the versions of a diagram through API
Post by: Geert Bellekens on September 07, 2019, 03:56:25 pm
There's a run button that you can use to see the results of your SQL Query.

Geert