'PowerDesigner->Tools->Execute Commands->Edit/Run Scripts
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl 'the current model
'get the current active model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "There is no current Model"
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
MsgBox "The current model is not an Physical Data model."
Else
ProcessFolder mdl
End If
'This routine copy name into code for each table, each column and each view
'of the current folder
Private sub ProcessFolder(folder)
Dim Tab 'running table
for each Tab in folder.tables
if not tab.isShortcut then
if len(tab.comment) <> 0 then
tab.name = tab.comment
end if
Dim col 'running column
for each col in tab.columns
if len(col.comment) <> 0 then
col.name= col.comment
end if
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut then
if len(view.comment) <> 0 then
view.name = view.comment
end if
end if
next
'go into the sub-packages
Dim f 'running folder
For Each f In folder.Packages
if not f.IsShortcut then
ProcessFolder f
end if
Next
end sub
如果注释有带双括号字典说明,需去除
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl 'the current model
'get the current active model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "There is no current Model"
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
MsgBox "The current model is not an Physical Data model."
Else
ProcessFolder mdl
End If
'This routine copy name into code for each table, each column and each view
'of the current folder
Private sub ProcessFolder(folder)
Dim Tab 'running table
for each Tab in folder.tables
i

这段代码主要用于处理PowerDesigner中的模型数据,通过遍历当前模型中的表格、列和视图,将注释内容复制到名称中。同时,如果注释包含特定字符,会进行处理。此外,还提供了将模型表结构导出到Excel的功能,包括表格的属性信息和字段信息,并设置了Excel的格式和显示选项。
最低0.47元/天 解锁文章
917

被折叠的 条评论
为什么被折叠?



