cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

powerdesigner - customization of database object using macro or vbscript.

Former Member
0 Likes
844

How can I parameterize a new database object in powerdesigner in order to replicate tables and rename them as work tables.

Accepted Solutions (0)

Answers (3)

Answers (3)

Ondrej_Divis
Contributor
0 Likes

One more thing. If you need to dereplicate certain attributes (e.g. Name, Code or anything else) by script, you need to use its attribute SourceReplication to get to the replication properties and the modify the string property called Attributes. See my example below, which dereplicates table name. Name of the replicated table in my example is "XXX".

For each t in Activemodel.Tables
  If t.Name = "XXX" then
    output t.SourceReplication.Attributes
    t.SourceReplication.Attributes = Replace(t.SourceReplication.Attributes, "Name" + vbLf, vbLf)
    output t.SourceReplication.Attributes
  End if
Next

Regards,

Ondrej

Ondrej_Divis
Contributor
0 Likes

If you replicate table into the same package as source table (it could be root level of the model as well), its Name and Code properties are automatically de-replicated, which means that you can modify the Name of replicated table instantly.

If you replicate tables between two different packages (with different Namespaces) or between two diffrent models, Name and Code are replicated/synchronized by default. To de-replicate certain properties you have to open the properties of replicated table and go to Version Info tab. You can open the replication properties from there. And choose which attributes, collections and/or sub-replication you need to keep in sync and which you don`t.

Ondrej

GeorgeMcGeachie
Active Contributor
0 Likes

In a script, use the CreateReplica function to replicate a table; then you should be able to rename the replica table. If you need to edit more than just the table name, you may need to access the replication rules, and I'm not sure where they are in the object model