PowerDesigner书签(03)显示comment字段注释内容

楔子:我来告诉你真相吧。所谓姻缘的红线是要两个人共同编织的。只有在两人牵手走到最后,其中一方死去时,这条红线才算完成,他们才算是真正被牵到一起了。- 东野圭吾《黎明之街》

1.今日书签

PowerDesigner 16.5 对表字段设置显示 comment 注释,解决视图模型看不到表字段 comment 中文注释的问题。
 

2.拨云见日

2.1.操作环境

操作系统:Win10
PowerDesigner 版本:16.5
 

2.2.操作步骤

无论 PowerDesigner 15 还是 PowerDesigner 16,视图中都没有直接设置显示属性字段注释的配置,所以需要我们通过间接的方式显示注释。操作的流程图如下:
1)选择表双击,在弹出来的界面(Table Properties)中切到 Tab Columns,然后按下面操作
显示comment字段注释内容1
显示comment字段注释内容2
设置完后,可以在界面(Table Properties)中看到已经调出来的 Comment 注释。
显示comment字段注释内容3
要解决视图模型展示 comment 字段的注释内容,需要再执行一个脚本。
继续
 

2)在菜单栏中选择 Tools >> Execute Commands >> Edit/Run Script...
显示comment字段注释内容4
3)在弹框中输入 VBS 脚本内容,并 Run 执行
显示comment字段注释内容5

脚本内容如下(直接复制粘贴运行即可):

Option   Explicit   
    ValidationMode   =   True   
    InteractiveMode   =   im_Batch
    Dim blankStr
    blankStr   =   Space(1)
    Dim   mdl   '   the   current   model  
      
    '   get   the   current   active   model   
    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)   
    On Error Resume Next  
          Dim   Tab   'running     table   
          for   each   Tab   in   folder.tables   
                if   not   tab.isShortcut   then   
                      tab.name   =   tab.comment  
                      Dim   col   '   running   column   
                      for   each   col   in   tab.columns   
                      if col.comment = "" or replace(col.comment," ", "")="" Then
                            col.name = blankStr
                            blankStr = blankStr & Space(1)
                      else  
                            col.name = col.comment   
                      end if  
                      next   
                end   if   
          next  
      
          Dim   view   'running   view   
          for   each   view   in   folder.Views   
                if   not   view.isShortcut   then   
                      view.name   =   view.comment   
                end   if   
          next  
      
          '   go   into   the   sub-packages   
          Dim   f   '   running   folder   
          For   Each   f   In   folder.Packages   
                if   not   f.IsShortcut   then   
                      ProcessFolder   f   
                end   if   
          Next   
    end   sub

4)完工
但是,看着有点别扭,感觉哪里怪怪的,和平常看到的有些不一样。
显示comment字段注释内容6
嗯,字段没了,再改造一下。
继续
 

5)点击菜单 Tools >> Display Preferences 菜单项
显示comment字段注释内容7
在弹出来的界面(Display Preferences)中找到 General Settings >> Table >> Advanced... 并点击 Advanced
显示comment字段注释内容8
6)在弹出来的界面(Customize Content)中找到 Columns >> List columns,右侧右上角有个放大镜,点击放大镜
显示comment字段注释内容9
7)在弹出来的界面(Select Attributes)中找到 Code 属性,并对其 D列 进行勾选
显示comment字段注释内容10
8)提示需要对适用对象范围进行选择,选项分别为所有对象、已选对象、新建对象。这里选择所有(All symbols)。
显示comment字段注释内容11
9)完活
但是,还是看着有点别扭,感觉哪里怪怪的,和平常看到的有些不一样。
显示comment字段注释内容12
嗯,字段顺序不一样,调整一下。
继续
 

10)现来一遍, Tools >> Display Preferences >> General Settings >> Table >> Advanced... >> Customize Content >> Columns >> List columns >> 点击放大镜 >> Select Attributes,找到 Code 属性,将其上移置顶
显示comment字段注释内容13
好像还差一点,注释在中间…
显示comment字段注释内容14
11)再来一遍,将 Display Name 项移动到D列已勾选的最后,OK
显示comment字段注释内容15
12)完美
显示comment字段注释内容16

3.系列书签

PowerDesigner书签(01)去掉Diagram画板黑色网格线
PowerDesigner书签(02)导入SQL脚本生成ER图
PowerDesigner书签(03)显示comment字段注释内容

猜你喜欢

转载自blog.csdn.net/itanping/article/details/108563626
今日推荐