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
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.
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