The solution for displaying name, code, and comment in PowerDesigner fixes the script, and the execution will not add comments repeatedly

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

Press on the PD: Ctr+shift + X, copy the above VBS script to it and run it. After improvement, it will not be repeated, and the description will not be added repeatedly if executed multiple times.

 

Transfer: http://blog.csdn.net/jockey/article/details/44682855

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327034150&siteId=291194637