on 08-10-2015 2:20 PM
I have the columns defined in the (parent/child) tables. The parent table has a single column PK. How do I use PD scripting to add a reference from the child to the parent and to identify one of the existing child table columns to be used in the reference?
Thanks in advance for the help.
As far as I can tell there is not document on teaching how to use Powerdesigner API.
Engineering provides some examples in online document. Excel Import Tool you are using is written in vbscript. It contains a lot of information on how to call an API. Some extensions also contain script. Finally Metamodel Objects Help (In PD go to Help) is very useful.
It'll take a while for you get used to the API.
Here is my latest example.
Create a reference between two tables (parent and child). Also using existing column in
child Table(childAddress) as foreign key.
set model = ActiveModel
set references = Model.references
set parent= model.findChildByName("parent", cls_Table)
set Pcolumn= parent.findChildByName("parentAddress", cls_Column)
set child = model.findChildByName("child", cls_Table)
set Ccolumn= child.findChildByName("childAddress", cls_Column)
set newRef = references.CreateNew()
newRef.name ="ABC"
newRef.code ="ABC"
set newref.childTable=child
set newref.ParentTable=parent
set Joins=newRef.Joins
for each j in Joins
set j.ChildTableColumn=cColumn
next
ActiveDiagram.AttachAllObjects
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
10 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.