Accessing Metadata by Script

You can access and manipulate PowerDesigner internal objects using Visual Basic Scripting. The scripting lets you access and modify object properties, collections, and methods using the public names of objects.

The PowerDesigner metamodel provides useful information about objects:

Information

Description

Example

Public name

The name and code of the metamodel objects are the public names of PowerDesigner internal objects

AssociationLinkSymbol

ClassMapping

CubeDimensionAssociation

Object collections

You can identify the collections of a class by observing the associations linked to this class in the diagram. The role of each association is the name of the collection

In PdBPM, an association exists between classes MessageFormat and MessageFlow. The public name of this association is Format. The role of this association is Usedby which corresponds to the collection of message flows of class MessageFormat

Object attributes

You can view the attributes of a class together with the attributes this class inherits from other classes via generalization links

In PdCommon, in the Common Instantiable Objects diagram, you can view objects BusinessRule, ExtendedDependency and FileObject with their proper attributes, and the abstract classes from which they inherit attributes via generalization links

Object operations

Operations in metamodel classes correspond to object methods used in VBS

BaseModel contains operation Compare that can be used in VB scripting

<<notScriptable>> stereotype

Objects that do not support VB scripting have the <<notScriptable>> stereotype

CheckModelInternalMessage

FileReportItem

PowerDesigner lets you access the MetaData via scripting using the MetaModel As BaseObject global property. There is only one instance of the MetaModel and it can be reached from anywhere through the global property Application.MetaModel.

This generic feature allows you to acccess the MetaModel on a generic way and implies a neutral code that you can use for any type of model. For example, you can use it to search for the last object modified in a given model.

Properties and collections are read-only for all MetaData objects.