Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Dermot

Pages: 1 ... 37 38 [39]

Reporting on Tagged Values is dependant on where the Tagged Value is – i.e. it could be in: Package/Element/Element.Attribute etc.

For each Section in the RTF report editor (Package/Element/Element::Attributes etc. )
There are two options for reporting Tagged Values:
1)  Using the Section (i.e. Element::Tagged Values)
2)  Using “Valueof” – (in the Element field list – for Element::Tagged Values)
The “ValueOf”  is last entry.  This requires the tagged Value to be named.  

Option 2 would probably be the easiest to use if you require the data be in a simple form and placed early in the report.

The Automation Interface suports the generation of RTF reports using:
 - RunReport (String, String, String)

For the details on this command see:

The latest version of EA - version 7.1, now supports scaling diagrams across multiple pages in RTF generated reports.  
See the entry from RoyC above, as well as:

Automation Interface, Add-Ins and Tools / Re: documentation rtf fields
« on: March 20, 2007, 05:15:27 pm »
The {Element.Tag} field does output the Element.Keywords data.  I am not sure why it has that name - I will pass this on to see if it should be corrected.

Automation Interface, Add-Ins and Tools / Re: How to use CSV-Import
« on: August 27, 2006, 06:17:05 pm »
In the CSV import specification you do need to specifiy the Element Type that you are going to create in EA.

So your "Select element field:"
- has to have at least : Name, Type

The Element Type can be:
Action, Activity, ActivityPartition, ActivityRegion, Actor, Artifact, Association, Boundary, Change, Class, Collaboration, Component, Constraint, Decision, DeploymentSpecification, DiagramFrame, EmbeddedElement, Entity, EntryPoint, Event, ExceptionHandler, ExitPoint, ExpansionNode, ExpansionRegion, GUIElement, InteractionFragment, InteractionOccurrence, InteractionState, Interface, InterruptibleActivityRegion, Issue, Node, Note, Object, Package, Parameter, Part, Port, ProvidedInterface, Report, RequiredInterface, Requirement, Screen, Sequence, State, StateNode, Synchronization, Text, TimeLine, UseCase

I hope this is of help.

Hello Gary,

It is suprising to hear that this code does work under Word 2003.  We did test it for Word 2000, 2002 & 2003.  We ended up using the library for Word 2000 as this was the one that seemed to cover all the versions best.

If you are looking at working on this in VB,  I would reccomend you reset the Word Object library to the Word 2003 - "Microsoft Word 11 Object library" See: for a graphical picture of where to set this in VB 6.

I assume you are already aware of the location for the source code: ttp://

I hope this is of help.


Automation Interface, Add-Ins and Tools / Re: Refresh Packages
« on: September 08, 2004, 05:28:48 pm »
Try using ReloadDiagram()  


I hope this is of help.


This is defined in a Element under Gentype See:

and search for Gentype.

I hope this is of help.

Automation Interface, Add-Ins and Tools / Re: ER DIAGRAM
« on: January 26, 2004, 04:54:45 pm »
EA supports creating UML data diagrams. To import a schema from an existing SQL database - create an ODBC connection to your SQL Database.

Create a package and a diagram for your data schema. Then from the main menu, select Project | Database Engineering | Import Schema from ODBC.  This will import the schema into the diagram.


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()

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:
There is an example code using this type of call in:

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" + _  
   Set Package = rep.Models.GetByName("Support")
   aPackageGuid = Package.PackageGUID
   Set aProject = rep.GetProjectInterface()
   aProject.RunHTMLReport aPackageGuid, "C:\temp", "BMP", "", "htm"
   Set rep = Nothing
End Sub

This was based on request for gettting inforation on Formal-Requirements across into the Test Cases of that object.

This is short piece of Automation Interface code that gives an example of:
- making updates to the repository
- Calling an application using parameters from EA

It needs to be called as an executable from EA.  There are details on the web site for calling an application from EA -

These details would differ for this application:

- The application Name: Requirements
- The command line would be: c:\{YourDir..}\Requirement.exe
- The Arguments would be:  $f, $p

On running EA - open the diagram with the Formal Requirements then select the installed application from the EA menu - Tools | Requirements.  This will give a simple msgbox asking if want to copy the name and notes of each Requirement element in that package.  On selecting 'Yes' it simply copies the Name and Details into a Test Case.

This is simple code.  It only checks if the records already
exist - if so it does not try to add the same name.

Here is the code below:


Option Explicit
Public EARepos As EA.Repository        ' The instance of an EA repository

Private Sub Main()
   'Get the command line parameters, Load the Repository
   'and set some defaults
   Dim Package As EA.Package
   Dim lPackageId As Long
   Dim EafileName As String

   'set what will be parameters in the procudure call
    If Len(Command) > 0 Then                    ' See if there are any arguments.

       ' The Ea repository location             'possible EA Arguments $f, $p
       EafileName = GetParams(Command, 0)
       ' get the package Id
       lPackageId = Val(GetParams(Command, 1))
       'No Arguments may not be running from EA..
       MsgBox ("Please set this up to be called as an application by EA passing the $f, $p arguments.  See:")
   End If
   OpenRepos (EafileName)                   'load up with sepcified path
   Set Package = EARepos.GetPackageByID(lPackageId)
   ScanElements Package
End Sub

Sub ScanElements(Package As Package)
   Dim idx As Integer, oElement As Element, PackageName As String
   ' Scan through each Element - Ask user if they want to add to tests
   For idx = 0 To Package.Elements.Count - 1
       Set oElement = Package.Elements.GetAt(idx)
       ' Check if there are details for this element to be output
        If oElement.Type = "Requirement" Then
           ' if so list the details for the element
           If MsgBox(oElement.Name + "  - Pass to test?", vbYesNo, _
           "Copy to Element Requirements") = vbYes Then
               ElementDetailToTest oElement
           End If
       End If
End Sub

Public Sub ElementDetailToTest(oElement As EA.Element)
    'Copy over the key details for a Requirement Element to Element Requirements
    Dim aTest As EA.Test, idx As Integer
    'Check the test is not already there
    For idx = 0 To oElement.Tests.Count - 1
       If oElement.Tests(idx).Name = oElement.Name Then
           MsgBox ("There is an existing Test of this name")
           Exit Sub
       End If
   ' Create a test case from the Formalrequirements
    Set aTest = oElement.Tests.AddNew(oElement.Name, "Standard")
    aTest.AcceptanceCriteria = oElement.Notes
    aTest.Input = oElement.Notes
End Sub

Public Function GetParams(ParamStr As String, ParamNum As Integer) As String
   Dim words() As String
   words = Split(ParamStr, ",")
   GetParams = words(ParamNum)
End Function

Public Function OpenRepos(EaProjName As String)

   'create the EA Reppository
   Set EARepos = New EA.Repository
   EARepos.OpenFile (EaProjName)                   'load up with sepcified path
   EARepos.ShowWindow (0)                          'optionally hide window

End Function



Automation Interface, Add-Ins and Tools / Working with Connectors
« on: September 28, 2003, 06:19:33 pm »
I have had a some requests from users trying to work out how to deal with outputing details about Connectors in diagrams.

Below is some example code that I have used for doing this.  The call from Main is a simple process for getting at some existing elements in the examle repository for 3.60.


Option Explicit

Public Sub DumpConnections(oElement As EA.Element, Rep As EA.Repository)
   Dim Idx As Integer
   Dim lNumRows As Long, iRows As Integer
   Dim AltObj As EA.Element
   Dim SourceStr As String, TagetStr As String
   Dim Connector As EA.Connector
   ' Set dimensions for the table
   lNumRows = oElement.Connectors.Count
   'Insert the table entries
   For iRows = 1 To lNumRows
          Set Connector = oElement.Connectors.GetAt(iRows - 1)
          ' Check which connector Supplier/Client is the Target/source
          If Connector.ClientID = oElement.ElementID Then
               'Client is the source
               'Set the Alternate Object as the target
               Set AltObj = Rep.GetElementByID(Connector.SupplierID)
               SourceStr = oElement.Name + " " + _
                    IIf(Len(Connector.ClientEnd.Cardinality) > 0, _
                    Connector.ClientEnd.Cardinality + ", ", "") + _
                    IIf(Connector.ClientEnd.Ordering, "Ordered ", "Unordered ")
               TagetStr = AltObj.Name + " " + _
                    IIf(Len(Connector.SupplierEnd.Cardinality) > 0, _
                    Connector.SupplierEnd.Cardinality + ", ", "") + " " + _
                    IIf(Connector.SupplierEnd.Ordering, "Ordered ", "Unordered ")
               'Supplier is the source

               Set AltObj = Rep.GetElementByID(Connector.ClientID)
               SourceStr = AltObj.Name + " " + _
                    IIf(Len(Connector.ClientEnd.Cardinality) > 0, _
                    Connector.ClientEnd.Cardinality + ", ", " ") + _
                    IIf(Connector.ClientEnd.Ordering, "Ordered ", "Unordered ")
               TagetStr = oElement.Name + " " + _
                    IIf(Len(Connector.SupplierEnd.Cardinality) > 0, _
                    Connector.SupplierEnd.Cardinality + ", ", " ") + _
                    IIf(Connector.SupplierEnd.Ordering, "Ordered ", "Unordered ")
           End If
           ' Column 1 - name and type of the connector
           Debug.Print "Connector Type: " + Connector.Type + _
               IIf(Connector.Direction <> "Unassigned ", " ", Connector.Direction)
           'Source object name and ordering
           Debug.Print "Source: " + SourceStr
           Debug.Print "Taget: " + TagetStr
           Debug.Print "Notes: " + Connector.Notes
   Set AltObj = Nothing
   Set Connector = Nothing
End Sub

Sub Main()

   Dim Package As EA.Package
   Dim Diag As EA.Diagram
   Dim Rep As EA.Repository
   Dim aPackageGuid As String
   Dim aProject As EA.Project
   Set Rep = New EA.Repository
   Rep.OpenFile "C:\Program Files\Sparx Systems\EA\EAExample.eap"
   '3.60 example repository
   Set Package = Rep.Models.GetByName("Messenger")
   Set Package = Package.Packages.GetByName("Model Views")
   Set Package = Package.Packages.GetByName("Analysis Model")
   Set Package = Package.Packages.GetByName("Address Book")
   ' display connections for just the first element
   DumpConnections Package.Elements.GetAt(0), Rep
   Set Rep = Nothing
End Sub

The code is written in Vba /VB 6.

If EA version 3.51 is still being used try using:
  'Using EA Version 3.51 ... Different EaExample
   Set Package = rep.Models.GetByName("Views")
   Set Package = Package.Packages.GetByName("Use Case View")
   Set Package = Package.Packages.GetByName("Business Process Model")
   Set Package = Package.Packages.GetByName("Process Model")

to replace the calls to the 3.60 pacakage set above.

Enjoy! :-)

Below is a simple set of code for testing or trying out commands when using the Automation Interface.

It uses the EaExample.eap file.  It is assumed a copy of this is stored in the default installation directory.

The following is some VBA/ VB 6 code for testing the command to generate the HTML report:

Sub Main()
   Dim rep As EA.Repository
   Dim Package As EA.Package
   Dim Diag As EA.Diagram
   Dim aPackageGuid As String
   Dim aProject As EA.Project
   Set rep = New EA.Repository
   'rep.OpenFile "C:\temp\EAExample.eap"
   rep.OpenFile "C:\Program Files\Sparx Systems\EA\EAExample.eap"
   'Using EA Version 3.51 ... Different EaExample
'   Set Package = rep.Models.GetByName("Views")
'   Set Package = Package.Packages.GetByName("Use Case View")
'   Set Package = Package.Packages.GetByName("Business Process Model")
'   Set Package = Package.Packages.GetByName("Process Model")
   'Using v3.60...EAexample
   Set Package = rep.Models.GetByName("Messenger")
   Set Package = Package.Packages.GetByName("Model Views")
   Set Package = Package.Packages.GetByName("Business Context Model")
   Set Package = Package.Packages.GetByName("Business Requirements Model")
   aPackageGuid = Package.PackageGUID
   'Place to test some commands..
   Set aProject = rep.GetProjectInterface()
   aProject.RunHTMLReport aPackageGuid, "C:\temp", "BMP", "", "htm"
   ' end test..
   Set rep = Nothing
End Sub

Please refer to for references on using the Automation Interface.

Automation Interface, Add-Ins and Tools / Automation Interface background
« on: September 26, 2003, 12:33:09 am »
This is just to give some background information about the Automation Interface :

On the website there is a new set of pages with some example code/application for using the Automation Interface.  This is available from:

There is a set of documentation defining the use of the Automation Interface available in the Enterprise Architect Helpfiles which can be found under the Help | Help Contents | Automation and Scripting menu item in EA.

There is reference to this in HTML format in EA under Help | Online Resources | Automation Interface - this takes you to the online version (The direct address to this:

Pages: 1 ... 37 38 [39]