In the project, you want to fill in all the name fields in the database modeled by Pd in the comment, and do not want to copy or paste a table, therefore, I checked some lazy and easy-to-use methods on the Internet. Originally, VBScript can be used to control objects in the PD for batch operations.
Start the PD file you want to modify, double-click the graph you want to modify, and activate it. Note that it is a graph, not a table under tables. Click "tools-> execute commands-> edit/run script..." in the menu, or press the shortcut key (CTRL + Shift + x)
Then paste the script and run it. The script is as follows:
Dim sname
For each table in activemodel. Tables
For each column in table. Columns
Scomm = column. getextendedattribute ("comment") 'comment content
Sname = column. getextendedattribute ("name") 'name content
'If scomm <> sname then
Column. Comment = column. Comment + column. Name
'End if
Next
Next
You can modify it as needed. If you have special requirements, you can check its script help document.
Some references found on the Internet are as follows:
UseVBScriptScript assistancePower DesignerModel Design
Power Designer It is a commonly used tool in data modeling. It is good at the design of large-scale E-R model.
For some batch operations, you can use VBScript Script.
Usage: Open the physical model, click "tools-> execute commands-> edit/run script...", or press the shortcut key (CTRL + Shift + x ).
The following script is a simple script that converts the table name and field name in the model to uppercase. In Power Designer 9.5.
VBScript In fact, I will not use it, so I will select a complicated example. This example is very simple.
As VBScript , You can go to the Internet to see the usage of those functions and structures, it is also very easy to use.
About Power Designer For some fixed attributes or entities used, refer Power Designer Can be found.
'*************************************** **************************************
'File: powerdesigner. ucase. vbs
'Version: 1.0
'Function: traverses all tables in the physical model, including the table name and tableCode, The field name and field code are changed from lowercase to uppercase;
'And the sequence name and code are changed from lowercase to uppercase.
'Usage: Open the physical model and run the script (CTRL + Shift + x)
'Note:
'*************************************** **************************************
Dim model 'current Model
Set Model = activemodel
If (model is nothing) then
Msgbox "there is no current model"
Elseif not model. iskindof (pdpdm. cls_model) then
Msgbox "the current model is not an physical data model ."
Else
Processtables Model
Processsequences Model
End if
'*************************************** **************************************
'Function: processsequences
'Function: recursively traverse all Sequences
'*************************************** **************************************
Sub processsequences (folder)
'Processing the sequence in the model: lowercase to uppercase
Dim Sequence
For each sequence in folder. Sequences
Sequence. Name = ucase (sequence. Name)
Sequence. Code = ucase (sequence. Code)
Next
End sub
'*************************************** **************************************
'Function: processtables
'Function: recursively traverse all tables
'*************************************** **************************************
Sub processtables (folder)
'Process tables in the Model
Dim table
For each table in folder. Tables
If not table. isw.cut then
Processtable table
End if
Next
'Recursion of sub-Directories
Dim subfolder
For each subfolder in folder. Packages
Processtables subfolder
Next
End sub
'************************************ **************************************** *
'function: processtable
'function: traverses all fields in the specified table and changes the field name from lowercase to uppercase,
'field code is changed from lowercase to uppercase
'table name is changed from lowercase to uppercase
'**************** **************************************** * *******************
sub processtable (table)
dim Col
for each Col in table. columns
'change the field name from lowercase to uppercase
Col. code = ucase (Col. code)
Col. name = ucase (Col. name)
next
table. name = ucase (table. name)
table. code = ucase (table. code)
end sub