PowerDesigner注释和name之间的互转

当前位置:

PowerDesigner注释和name之间的互转

作者:邓华锋于2013-7-31发布在 分类:开发工具 / 阅读36891 次 / 共有0条评论  

很多时候我们需要将PowerDesigner设计的表中的name作为注释,这是可以使用下面的vb脚本来实现:(来自网络):

执行方法:Open PDM -- Tools -- Execute Commands -- Run Script


Option   Explicit 
ValidationMode   =   True  
InteractiveMode   =   im_Batch  
           
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  
           
'   This   routine   copy   name   into   comment   for   each   table,   each   column   and   each   view   
'   of   the   current   folder   
Private   sub   ProcessFolder(folder)   
      Dim   Tab   'running     table   
      for   each   Tab   in   folder.tables   
            if   not   tab.isShortcut   then   
                  tab.comment   =   tab.name   
                  Dim   col   '   running   column   
                  for   each   col   in   tab.columns   
                        col.comment=   col.name   
                  next   
            end   if   
      next  
           
      Dim   view   'running   view   
      for   each   view   in   folder.Views   
            if   not   view.isShortcut   then   
                  view.comment   =   view.name   
            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


如果需要将comment转为name可以使用下面的脚本: 


Option   Explicit   
ValidationMode   =   True  
InteractiveMode   =   im_Batch  
         
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="" then  
                  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 


  • 标签: powerdesigner 注释 name 互转
  • 该日志于 2013-7-31 23:17 由 邓华锋 发表在 邓华锋 上,你除了可以发表评论外,还可以转载"PowerDesigner注释和name之间的互转"日志到你的网站或博客,但是请保留源地址及作者信息,谢谢!!
  • 版权所有:《邓华锋》 => 《PowerDesigner注释和name之间的互转
    本文地址:http://dhf.ink/post-214.html
    除非注明,文章均为 《邓华锋》 原创,欢迎转载!转载请注明本文地址,谢谢。