PowerDesigner顯示Comment註釋

PowerDesigner默認顯示的列是Name及類型,以下圖示:網絡

如今須要顯示註釋列,以便使得ER圖更加清晰。可是PowerDesigner勾選Comment顯示沒有效果,因此經過如下幾步來處理:3d

雙擊表,彈出表屬性對話框,切到ColumnTab,默認是沒顯示Comment的,顯示Comment列,這麼作code

設置顯示Commentblog

有了Comment列,並補充Comment信息ip

肯定保存,打開菜單 Tools>Display Perferences..ci

調整顯示的Attributeget

OK,保存,肯定,退出設置頁,應用到全部標識,能夠看到表變化it

接下來須要執行VBS腳本,借鑑網絡上的腳本,而且完善了下,處理Comment爲空的情形io

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

打開菜單Tools>Execute Commands>Edit/Run Script.. 或者用快捷鍵 Ctrl+Shift+Xtable

執行完,能夠看到第3列顯示備註哈哈,效果以下

原理就是把顯示name的列的值,替換成註釋的值,因此下次若是調整comment,還有從新執行腳本,因此最好放在最後執行。

相關文章
相關標籤/搜索