on 02-12-2015 7:08 PM
Hi
couple of questions on VB Scripting for Powerdesigner:
1. How do we use vb script to assign a domain for a an attribute in a logical model?
2. is there any easy way to change a attribute order, say the attribute is currently in 20 the position, i want to programattically move it to 2nd position.
thank you
Hi,
To attach a domain to entity attribute, use "set attr.Domain = mydomain"
To move items in collection, use the Move property "collection.Move <destination>, <source>"
You can refer to chm Help > Metamodel object help.
Here is a sample doing what you want
<<
' create model with one entity, 20 attributes and one domain
dim ldm, ent, itr, dom
set ldm = CreateModel(pdldm.cls_Model)
set ent = ldm.Entities.CreateNew()
output ent.ShortDescription
for itr = 0 to 19
ent.Attributes.CreateNew()
next
set dom = ldm.Domains.CreateNew()
' Attach attribute_7 to domain
Set ent.Attributes.Item(6).Domain = dom
' Put attribute_13 to first position
ent.Attributes.Move 0, 12
>>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.