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