Skip to main content

Data & Intelligence

PowerDesigner Tips – Utility Scripts

Here’s a few utility scripts I’ve developed to aid in your XEM scripting:

Scope

Many functions, especially members of ExtensibleObject, require the “scope” or code of the XEM be included when referencing extended attributes, methods, collections, etc.  I’ve added these lines to the global script section as a helper:

' Extension navigation. All references to extended attributes and methods

'  must use the EXT() function when referencing the name

const EXTNAME = "PerficientStds"

 

Function EXT(iden)

   EXT = EXTNAME + "." + iden

Data Intelligence - The Future of Big Data
The Future of Big Data

With some guidance, you can craft a data platform that is right for your organization’s needs and gets the most return from your data capital.

Get the Guide

End Function

Whenever I reference an extended object, I use EXT(extCustomAttribute).

Shortcuts

PowerDesigner has the concept of a “shortcut”, a reference to an object.  As you navigate the model, you’ll often find shortcuts where you expected objects and even shortcuts to shortcuts. Thus:

' Return the base object, dereferencing any shortcuts

Function TgtObj(obj)

   If Not IsObject(obj) Then Set TgtObj = Nothing : Exit Function

   Set TgtObj = obj

   While TgtObj.IsShortcut()

      Set TgtObj = TgtObj.TargetObject

   Wend

End Function

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Chris Grenz

More from this Author

Follow Us
TwitterLinkedinFacebookYoutubeInstagram