Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: sr on November 11, 2003, 07:48:58 am

Title: Automation support for SQL-Repository
Post by: sr on November 11, 2003, 07:48:58 am
How can I access an SQL-Repository by the Automation Interface?
Title: Re: Automation support for SQL-Repository
Post by: Dermot on December 01, 2003, 04:15:18 pm
Repository.Open( ) is the command for opening a repository in the Automation Interface .  The parameter for this can have a file path or an ODBC string as the parameter.  An example of this is attached below.

This can be further automated by calling your application from within EA and passing across a parameter in the call.  See: http://www.sparxsystems.com.au/AutIntVBCallingFromEA.htm
There is an example code using this type of call in:
http://www.sparxsystems.com.au/AutIntVBDownload.htm

I hope this of help.

Sub Main()
   Dim rep As EA.Repository
   Dim Package As EA.Package
 
   Dim aPackageGuid As String
   Dim aProject As EA.Project
   
   Set rep = New EA.Repository
  ‘ ODBC path ..
   rep.OpenFile "SQLREPOS ---
      DBType=1;Connect=Provider=MSDASQL.1; _
      Password=xxxxx;Persist Security _
      Info=True;User ID=xx;Data Source=xxxxx"
   ‘ File path
   'rep.OpenFile "C:\Program Files\Sparx" + _  
   "Systems\EA\EAExample.eap"
   
   Set Package = rep.Models.GetByName("Support")
   aPackageGuid = Package.PackageGUID
   
   Set aProject = rep.GetProjectInterface()
   aProject.RunHTMLReport aPackageGuid, "C:\temp", "BMP", "", "htm"
   
   rep.Exit
   Set rep = Nothing
   
End Sub
:)
Title: Re: Automation support for SQL-Repository
Post by: Dermot on December 01, 2003, 04:21:39 pm
Just an update on that - use the ODBC string defined in EA when doing:
File | Open
Copy the text from the ODBC link in the field: Project to Open
Use this text as the ODBC string in Repositpory.OpenFile()
:)