0

I really need help with this problem, I just cannot figure out. Here's the deal:

Concept

I use Power Designer to design models, which then are imported into a SAS meta server. I would like to write a VBScript that checks my model for errors. SAS uses some attributes, that my PD doesn't have so I have a XEM file attached to my model that contains extended attributes to my tables and columns. I can check my extended attributes for errors except for one possible source of problem. If I open a table and go to Extended Attributes, then there is a column (for all extended attributes) called "R" (right side from the extended attributes "Value" column) which stands for "Redefined" and it's always ticked (true) if I give value to an extended attribute, and always unticks (false) itself if I empty the extended attribute's value. I would like to write a script which checks if an extended attribute has value, but doesn't have the "R" column ticked (true) or the redefined checkbox is ticked, but the extended attribute doesn't have a value.

Question

How can I access the information with VBScript, that a Extended attribute for a table, or column is redefined or not?

Here's the code I use to check the value of extended attributes. I probably just don't understand the object structure of PD and, can't figure out, how to check "R" (redefined), instead of value...

Here's a code I use to get information about Extended Attributes:

For Each ModelExtension In ActiveModel.ExtendedModelDefinitions
    For Each ExtAttr in ModelExtension.GetMetaExtensionsForClass(PdPDM.Cls_Column, Cls_ExtendedAttributeTargetItem)
         'SASFormat is an extended attribute for columns
        If ExtAttr.Name="SASFormat" Then
            output ExtAttr.Name
            output ExtAttr.ObjectID
            output ExtAttr.Model
        End if
    Next
Next

And this I use to get values of all extended attribute for columns:

For Each Table In ActiveModel.Tables
      For Each Column In Table.Columns
            'Extended attributes check

            For Each ModelExtension In ActiveModel.ExtendedModelDefinitions
                For Each ExtAttr in ModelExtension.GetMetaExtensionsForClass(PdPDM.Cls_Column, Cls_ExtendedAttributeTargetItem)
                    xEAN = ExtAttr.Name
                    xEAValue = Column.GetExtendedAttributeText(xEAN)
                    tn=Table.Name
                    cn=Column.Name

                    output tn
                    output cn
                    output xEAN
                    output xEAValue
                    end if
                Next
            Next
     Next
Next

TL;DR

How can I access the information with VBScript, that a Extended attribute for a table, or column is redefined or not?

  • There's another method `GetExtendedAttribute`, which takes a second parameter `AvailabilityMode`. This one is not documented in the .chm, but it seems that if you set it to `2` (instead of the default `1`), you get the actual value of the extended attribute for this object, without the default value. Maybe it could help you. – pascal Nov 06 '13 at 20:48
  • Thank you for your answer pascal. Actually, I have figured it out, that the "Redefined" only means, that the Extended Attribute's value is different from the default value for the Extended Attribute in the attached extension (XEM) file. So basically if the ExtAttrValue = ExtrAttrDefaultValue then Redefined = false, else it's true. Thank you for the answer though :) – levaycsanad Nov 08 '13 at 14:01

0 Answers0