PowerDesigner默認顯示的列是Name及類型,如下圖示:
現在需要顯示注釋列,以便使得ER圖更加清晰。但是PowerDesigner勾選Comment顯示沒有效果,所以通過以下幾步來處理:
雙擊表,彈出表屬性對話框,切到ColumnTab,默認是沒顯示Comment的,顯示Comment列,這么做
設置顯示Comment
有了Comment列,並補充Comment信息
確定保存,打開菜單 Tools>Display Perferences..
調整顯示的Attribute
OK,保存,確定,退出設置頁,應用到所有標識,可以看到表變化
1 Option Explicit 2 ValidationMode = True 3 InteractiveMode = im_Batch 4 Dim blankStr 5 blankStr = Space(1) 6 Dim mdl ' the current model 7 8 ' get the current active model 9 Set mdl = ActiveModel 10 If (mdl Is Nothing) Then 11 MsgBox "There is no current Model " 12 ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then 13 MsgBox "The current model is not an Physical Data model. " 14 Else 15 ProcessFolder mdl 16 End If 17 18 Private sub ProcessFolder(folder) 19 On Error Resume Next 20 Dim Tab 'running table 21 for each Tab in folder.tables 22 if not tab.isShortcut then 23 tab.name = tab.comment 24 Dim col ' running column 25 for each col in tab.columns 26 if col.comment = "" or replace(col.comment," ", "")="" Then 27 col.name = blankStr 28 blankStr = blankStr & Space(1) 29 else 30 col.name = col.comment 31 end if 32 next 33 end if 34 next 35 36 Dim view 'running view 37 for each view in folder.Views 38 if not view.isShortcut then 39 view.name = view.comment 40 end if 41 next 42 43 ' go into the sub-packages 44 Dim f ' running folder 45 For Each f In folder.Packages 46 if not f.IsShortcut then 47 ProcessFolder f 48 end if 49 Next 50 end sub
打開菜單Tools>Execute Commands>Edit/Run Script.. 或者用快捷鍵 Ctrl+Shift+X
執行完,可以看到第3列顯示備注哈哈,效果如下
原理就是把顯示name的列的值,替換成注釋的值,所以下次如果調整comment,還有重新執行腳本,所以最好放在最后執行。
轉載自 ,博主地址:http://blog.csdn.net/difffate。 https://blog.csdn.net/difffate/article/details/77945239