1. 程式人生 > 其它 >PowerDesigner顯示Common註釋列並自動賦值

PowerDesigner顯示Common註釋列並自動賦值

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