PowerDesigner中默認不顯示Common注釋列,可根據以下步驟顯示並紫東填充Name列內容。
1、顯示Common注釋列
2、運行VB Script腳本自動賦值
使用Shift+Ctrl+X快捷鍵打開腳本運行窗口,粘貼以下代碼執行即可。
注:若Common列為空,則填充Name列內容;不為空則不變。
'如果comment為空,則填入name;如果不為空,則保留不變,避免已有的注釋丟失. Option Explicit ValidationMode = True InteractiveMode = im_Batch Dim mdl 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 Private sub ProcessFolder(folder) Dim Tab for each Tab in folder.tables if not tab.isShortcut then if trim(tab.comment)="" then '如果有表的注釋,則不改變它.如果沒有表注釋.則把name添加到注釋里面. tab.comment = tab.name end if Dim col for each col in tab.columns if trim(col.comment)="" then '如果col的comment為空,則填入name,如果已有注釋,則不添加;這樣可以避免已有注釋丟失. col.comment= col.name end if next end if next Dim view for each view in folder.Views if not view.isShortcut and trim(view.comment)="" then view.comment = view.name end if next Dim f For Each f In folder.Packages if not f.IsShortcut then ProcessFolder f end if Next end sub
顯示以下內容說明執行完成。