cancel
Showing results for 
Search instead for 
Did you mean: 

vb script - logical model

Former Member
0 Kudos


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

Accepted Solutions (1)

Accepted Solutions (1)

marc_ledier
Active Participant
0 Kudos

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

>>

Former Member
0 Kudos

Thank you Marc; will try these out.

appreciate your help.

Krishna

Answers (0)