在powerdesigner中选择
Tools->Display Preferences->Content->Table->Advanced…->Columns->select
选中Code后,将它上移到第一位
这样可以将code、name、type三项显示在ER图中,然后运行脚本,将注释comment的内容替换到code或name中,即可。
PowerDesigner拥有强大的建模功能,同时,它也对脚本语言提供了支持。菜单Tools -> Execute Commands -> Edit/Run Script打开的窗口中,可以执行用户编写的VBS脚本,某些情况下,这可以节省大量的重复性工作,达到提高效率的目的。
vbs文件内容:
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim system, file
Set system = CreateObject(“Scripting.FileSystemObject”)
Dim ForReading, ForWriting, ForAppending
ForReading
ForWriting
ForAppending = 8 ‘ 可写并追加
‘打开文本文件
Set file = system.OpenTextFile(“C:\pdcomment.txt”, ForWriting, true)
‘判断当前model是否物理数据模型
Dim mdl
Set mdl = ActiveModel
If (mdl Is Nothing) Then
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
Else
End If
file.Close
‘******************************************************************************
Private sub ProcessFolder(folder,file)
Dim i,j,k
i=0:j=0:k=0
‘列数组,记录字段里不重复的comment
Dim ColumnComment()
Dim ColumnCommentNumber()
ReDim Preserve ColumnComment(i)
ReDim Preserve ColumnCommentNumber(i)
Dim tbl
Dim col
dim curComment ‘当前字段comment
‘处理模型中的表
for each tbl in folder.tables
next
Dim view ‘当前视图
for each view in folder.Views
next
‘对子目录进行递归
Dim subpackage ‘folder
For Each subpackage In folder.Packages
Next
end sub
发表评论