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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值