Automating ERStudio DA

From ER/Studio Data Architect
Jump to: navigation, search

Go Up to User Guide

Notepad blue icon 2.pngNote: If you want to view the Automation Interface Reference help file, you can do so in two ways:

  • In the program menu, choose Help > Automation Interface Reference. This will open the .chm file.
  • Or download the AIRef.chm file from http://docs.embarcadero.com/products/er_studio/ (If you are using Windows to view the .chm file, you may need to right-click and unblock the file).


Automation Interface objects are scriptable controls for most ER/Studio Data Architect functions. You can create macros to automate repetitive tasks or to extend the functions already found in the application. A few days coding can save months of human resources in the long run as described in Why Use Automation Objects?.

This section is intended for programmers with a working knowledge of BASIC. You can learn it using ER/Studio Data Architect's macro editor, but you will also need a textbook devoted specifically to beginner BASIC programmers. The macro language is SAX BASIC, similar to MS Visual BASIC. There are a few, but critical, syntactic differences from other BASIC languages. See the Introduction to the Automation Interface Reference Guide, which is accessible from the Help menu, to save some debugging time.

You can also create event handlers to run automatically every time you perform an action in the application, such as Add Entity. See Creating Event Handlers. You can also write handlers for update events, see Handling Update Events.

A number of example macros are included. To see them, open any ER/Studio Data Architect *.dm1 file, switch to the Macro tab in the Data Model Explorer, and double-click any sample macro. The macro will open in the Macro Editor.

AIBlockDiag.gif

The diagram above shows the differences between using macros within ER/Studio Data Architect and running your own COM application external to ER/Studio Data Architect. In the external case, you will need to create a link to the ER/Studio Data Architect Type Library and declare ERStudio object types. Example applications using MS Visual Basic 6.0 and.Net VB and C# are in your installation directory under "..\Program Files\ERStudio Data Architect X.X\Readme\TableList.zip ."

Internally, the only difference is that the namespace, type library, and top-level application objects are already created before you run or edit a macro. Otherwise the code for external and internal applications will be nearly identical. You can copy and paste code from your macros to an external application with few changes.

For example, if you want to let users automatically export ER/Studio Data Architect model metadata to applications like Microsoft Excel, and simultaneously add the created file to a Microsoft Outlook message for distribution, you can write a macro to take advantage of this object interaction.

Topics covered in this section include:

See Also