PowerDesigner16配置显示注释comment配置方法

超、凢脫俗 2022-05-14 10:22 856阅读 0赞

PowerDesigner默认显示的列是Name及类型,如下图示:

SouthEast

现在需要显示注释列,以便使得ER图更加清晰。但是PowerDesigner勾选Comment显示没有效果,所以通过以下几步来处理:

双击表,弹出表属性对话框,切到ColumnTab,默认是没显示Comment的,显示Comment列,这么做

SouthEast 1

设置显示Comment

SouthEast 2

有了Comment列,并补充Comment信息

SouthEast 3

确定保存,打开菜单 Tools>Display Perferences..

SouthEast 4

调整显示的Attribute

SouthEast 5

OK,保存,确定,退出设置页,应用到所有标识,可以看到表变化

SouthEast 6

接下来需要执行VBS脚本,借鉴网络上的脚本,并且完善了下,处理Comment为空的情形

  1. Option Explicit
  2. ValidationMode = True
  3. InteractiveMode = im_Batch
  4. Dim blankStr
  5. blankStr = Space(1)
  6. Dim mdl ' the current model
  7. ' get the current active model
  8. Set mdl = ActiveModel
  9. If (mdl Is Nothing) Then
  10. MsgBox "There is no current Model "
  11. ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
  12. MsgBox "The current model is not an Physical Data model. "
  13. Else
  14. ProcessFolder mdl
  15. End If
  16. Private sub ProcessFolder(folder)
  17. On Error Resume Next
  18. Dim Tab 'running table
  19. for each Tab in folder.tables
  20. if not tab.isShortcut then
  21. tab.name = tab.comment
  22. Dim col ' running column
  23. for each col in tab.columns
  24. if col.comment = "" or replace(col.comment," ", "")="" Then
  25. col.name = blankStr
  26. blankStr = blankStr & Space(1)
  27. else
  28. col.name = col.comment
  29. end if
  30. next
  31. end if
  32. next
  33. Dim view 'running view
  34. for each view in folder.Views
  35. if not view.isShortcut then
  36. view.name = view.comment
  37. end if
  38. next
  39. ' go into the sub-packages
  40. Dim f ' running folder
  41. For Each f In folder.Packages
  42. if not f.IsShortcut then
  43. ProcessFolder f
  44. end if
  45. Next
  46. end sub

打开菜单Tools>Execute Commands>Edit/Run Script.. 或者用快捷键 Ctrl+Shift+X

SouthEast 7

执行完,可以看到第3列显示备注哈哈,效果如下

SouthEast 8

原理就是把显示name的列的值,替换成注释的值,所以下次如果调整comment,还有重新执行脚本,所以最好放在最后执行。

原文链接 https://blog.csdn.net/difffate/article/details/77945239

发表评论

表情:
评论列表 (有 0 条评论,856人围观)

还没有评论,来说两句吧...

相关阅读