System Architect provides integrated support for Microsoft VBA and its development environment. The programming environment, debugging environment, and language is the same VBA found throughout the industry, including Microsoft Office products. Combining System Architect with VBA provides you with a standard development environment for creating customizable solutions incorporating all the programming developments provided by Microsoft, including IntelliSense and Microsoft forms.
This tip will be the first of a series of tips that will describe System Architect's VBA and show you how to build a simple macro. In this tip we'll take a look at what VBA enables you to do, and how it is accessed.
Reasons to use VBA with SA
VBA can be used for various automation tasks. Some potential reasons for seeking to customize System Architect with VBA are:
Modifying application behavior - Modify the way System Architect works to match your company’s business rules. For example, when a user creates a symbol on a diagram, your company's naming standards could be checked and the user is flagged if they are broken.
Automating repetitive tasks - Combine sets of common manual tasks into a series of actions that can be executed over and over. For example, you could print a user-defined set of diagrams.
Extending application functionality - Add features to System Architect that are not available 'out of the box'. For example, you could automatically create a Process Map diagram with swimlanes that is derived from a Process Chart and the assigned roles of the elementary business processes on the diagram, and the roles' Organizational Units.
Integrating with other applications - Control another application to exploit functionality not normally available. For example, you could produce an Excel Spreadsheet of Process versus Entity CRUD information.
Accessing corporate data - Exchange data with remote databases and applications that aren’t normally capable of database access. For example, you could automatically import information from diverse sources that cannot be imported directly.
Opening the VBA IDE
The VBA Interactive Development Environment (IDE) is accessed by selecting Tools, Macros, VBA Editor while in System Architect. Future tips will guide you through building a simple macro. This week, we'll take a look at the two main reference sources for building a macro - both enable you to view System Architect's object model.
The object browser
The Objects available to VBA from System Architect can be viewed through the Object Browser in the VBA editor. Each type of object is defined as a class which contains a list of supported properties and methods. The Object Browser is accessed by selecting View, Object Browser in the VBA IDE.
The object model
A much easier way of viewing the whole model is by using a class diagram. System Architect’s object model is represented by a Class diagram, provided in an encyclopedia shipped with the product named Object Model.
To view the object model, perform the following steps:
- Open the encyclopedia located in the C:\Program Files\Popkin Software\System Architect\Encyclopedias\Object Model directory.
- This encyclopedia contains one diagram - a class diagram named Object Model. Open it. The object model class diagram presents all of the classes of the object model, their attributes and functions, and the associations between other classes.
Within System Architect, you can open the definition of each class, and examine its properties (attributes) and its methods. The methods are functions that you can use while programming to get information or do things in SA. Here is a quick summary of the classes in the Object Model:
Application Object - This is the System Architect application object, through which the user interface can be controlled. It is the highest level object in the object model.
Encyclopedia Object - enables access to the encyclopedia’s properties and methods.
Diagram Object - enables access to a diagram's properties and methods.
Symbol Object - enables access to a symbol's properties and methods. Symbols are always contained in diagrams.
Definition Object - enables access to a definition's properties and methods. Definitions define symbols; some definitions exist independently of symbols (ie, a requirement, or an attribute of a class definition).
MetaModel Object - provides access to the metaclass objects for an encyclopedia.
MetaClass Object - provides information about an individual object type in the encyclopedia. It corresponds to information in saprops.cfg and usrprops.txt for specific types of object.
MetaItem Object - provides information about an individual object type in the encyclopedia. It corresponds to information in saprops.cfg and usrprops.txt for specific types of object.
MetaProperty Object - allows you to retrieve information about each property for a specific object in the encyclopedia. This object corresponds to the Property keyword in saprops.cfg and usrprops.txt files.
MetaKeyedBy Object - retrieves information about the key structure of a MetaProperty Object.