powerdesign中逆向工程后name和comment的互换

  powerdesign 中,将数据库中可以逆向生成pdm的结构图,比较清晰看到系统的结构, 
但假如是db先行的话,一般是db中的每个列中用comment中文注释说明这列是 
干什么的,但逆向工程后,会发现pd中的name和code都变成中文, 
其中我们期望的是name是中文,code是英文(就是db中的列),那么我们其实 
可以将db中的comment跟name进行一个复制,把comment中的内容都全部复制到 
name中去就可以了,网上找到这个VBS脚本,原来pd中的也可以用VBS对PD的对象进行编程的, 

VBS脚本如下: 

 pasting

  1. Option Explicit  
  2. ValidationMode = True  
  3. InteractiveMode = im_Batch  
  4.   
  5. Dim mdl   
  6.   
  7.   
  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.    Dim Tab  
  18.    for each Tab in folder.tables  
  19.       if not tab.isShortcut then  
  20.          if (not isnull(tab.comment)) and (trim(tab.comment)<>"") then  
  21.             tab.name = tab.comment  
  22.          end if  
  23.          Dim col   
  24.          for each col in tab.columns  
  25.          if (not isnull(col.comment)) and  (trim(col.comment)<>"")   then  
  26.             col.name= col.comment  
  27.          end if  
  28.          next  
  29.       end if  
  30.    next  
  31.   
  32.    Dim view  
  33.    for each view in folder.Views  
  34.       if not view.isShortcut then  
  35.          if (not isnull(view.comment)) and (trim(view.comment)<>"") then  
  36.             view.name = view.comment  
  37.          end if  
  38.       end if  
  39.    next  
  40.   
  41.      
  42. end sub 
原文地址:https://www.cnblogs.com/tangruixin/p/11474335.html