you're reading...
PowerDesigner, XEM

Creating Extended Dependencies in VBScript

We use scripts to automate repetitive tasks, and that usually means things like creating tables, columns, views, etc.  So, I’ve generally gotten pretty fast at putting together those types of scripts.  For my last script, I wanted to create a view on top of a set of tables, and create an extended dependency to link them together.  By putting a stereotype on the extended dependency, I would always be able to identify the particular view created by these scripts, no matter what changes were made to them.

Typically we create a new object by doing something like:

dim extDep
set extDep = obj.ExtendedDependencies.CreateNew()

No luck.  I tried a few variations, and then hit the groups.  I found several examples for creating extended dependencies:

Set NewExtendedDependency =ExDepColl.CreateNew(0)
NewExtendedDependency.InfluentObject = BaseTable
NewExtendedDependency.DependentObject = HistoryTable


Set EDep = prc.ExtendedDependencies.CreateNew() 
Set EDep.InfluentObject = IObj
EDep.Stereotype = ed.Stereotype

Unfortunately, I could not get either to work, and while I’m certainly willing to admit the problem may lie between the keyboard and chair, what I eventually found that did work was:

Set ExtDep = ActiveModel.CreateObject(cls_ExtendedDependency)

So, the key is to first create an object of type cls_ExtendedDependency THEN use the Add method to put it in the ExtendedDependencies collection.



2 thoughts on “Creating Extended Dependencies in VBScript

  1. Thanks Rich! This is very useful. Do you know how I add a ExtendedDependencies of a table? I can insert a line on a view ExtendedDependencies propertie, but I need to specify the reference.
    Thanks in advance for your help.

    Posted by Pedro Soares | March 1, 2013, 2:14 pm
    • Wow, there’s a lot of comments here and I recently discovered that I wasn’t getting notified of them. So I apologize for anyone I’ve missed and here’s a code snippet for the most recent question.

      To create an extended dependency you need to first create the dependency, then add it to the collection on your first object . Then you set the influentobject property to the second .

      Set ExtDep = ActiveModel.CreateObject(cls_ExtendedDependency)
      Set ExtDep.InfluentObject =

      Hope this helps.

      Posted by Rich Kier | March 13, 2013, 12:42 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: