Discussion:
How to Iterate all extended attributes in VB
(too old to reply)
saj14saj
2010-10-06 13:26:36 UTC
Permalink
I am trying to write some custom import/export support code for
PowerDesigner. My company has extended the objects (Business
Processes in this case) with extended attrbitutes.

I see in the online documentation how to get/set/test existence of a
given extended attribute (via GetExtendedAttrribute,
SetExtendedAttribute, HasExtendedAttribute) IF THE NAME IS KNOWN.

I cannot find any where in the documentation how to get a list of
extended attribute names to iterate over.... how is this done? Is
it a named collection? If so, what is the name? I cannot find
documentation on that, although I have looked.

Thank you very much.
Roman Dynnik
2010-10-09 17:38:30 UTC
Permalink
Post by saj14saj
I see in the online documentation how to get/set/test existence of a
given extended attribute (via GetExtendedAttrribute,
SetExtendedAttribute, HasExtendedAttribute) IF THE NAME IS KNOWN.
On Oct 6, 5:26 pm, saj14saj
Post by saj14saj
I cannot find any where in the documentation how to get a list of
extended attribute names to iterate over....   how is this done?   Is
it a named collection?  If so, what is the name?  I cannot find
documentation on that, although I have looked.
As you noticed, PD doesn't provide any VBA metamodel method to iterate
Extended Attribute Collection.
Although you can use source xml-file .xem to get that collection
through XMLDOM-API/XPath and MSXML.XmlDocument COM-object.

there is part example of .xem file:

<o:ExtendedAttributeTypeTargetItem Id="o15">
<a:ObjectID>E223B36F-D387-4620-990A-978DE8526844</a:ObjectID>
<a:Name>DialectType</a:Name>
<a:CreationDate>0</a:CreationDate>
<a:Creator/>
<a:ModificationDate>0</a:ModificationDate>
<a:Modifier/>
<a:Comment>NHibernate dialect type</a:Comment>
<a:TargetCategory.Type>1</a:TargetCategory.Type>
<a:ExtendedAttributeTypeTargetItem.Value>NHibernate.Dialect.SybaseDialect</
a:ExtendedAttributeTypeTargetItem.Value>
<a:ExtendedAttributeTypeTargetItem.ListOfValues>NHibernate.Dialect.GenericDialect
NHibernate.Dialect.SybaseDialect
NHibernate.Dialect.Oracle9Dialect
NHibernate.Dialect.OracleDialect
NHibernate.Dialect.DB2Dialect
NHibernate.Dialect.MsSql2000Dialect
NHibernate.Dialect.MsSql7Dialect
NHibernate.Dialect.MySQLDialect
NHibernate.Dialect.SQLiteDialect
NHibernate.Dialect.PostgreSQL81Dialect
NHibernate.Dialect.PostgreSQLDialect
NHibernate.Dialect. FirebirdDialect</
a:ExtendedAttributeTypeTargetItem.ListOfValues>
</o:ExtendedAttributeTypeTargetItem>

Regards, Roman Dynnik
rkkier
2010-10-13 02:16:56 UTC
Permalink
Try this (I did my sample with a PDM because that's what I had
handy). I think this'll get you what you want. There are a slew of
other methods and properties available, just pull up the help on
extendedattribute.

---------------------------

dim tab
dim foo
dim bar

for each tab in activemodel.tables

set foo = tab.getmetaextensions(cls_extendedattributetargetitem)
for each bar in foo
output bar.name
next

next

Best of luck. If you get a complete solution please post a reply.
Loading...