PowerDesigner顯示Comment註釋

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

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

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

設置顯示Comment.net

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

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

調整顯示的Attributeblog

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

 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列顯示備註哈哈,效果以下ci

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

 

轉載自 ,博主地址:http://blog.csdn.net/difffate。 https://blog.csdn.net/difffate/article/details/77945239
相關文章
相關標籤/搜索