`
shuai1234
  • 浏览: 938060 次
  • 性别: Icon_minigender_1
  • 来自: 山西
社区版块
存档分类
最新评论

PowerDesigner工具comment和name互相复制

    博客分类:
  • java
 
阅读更多

复制下面脚本,在PowerDesigner中依次点击:Tools->Execute Commands->Edit/Run Script,粘贴代码到下面的文本框,点击 Run 按钮即可实现相应的复制

 

注意:因name列不允许重复,所以在执行脚本时,comment列中不能出现重复信息

 

1、comment复制到name 脚本代码:

 

Option   Explicit   

ValidationMode   =   True   

InteractiveMode   =   im_Batch   

Dim   mdl      

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)   

        Dim   Tab   

        for   each   Tab   in   folder.tables   

              if   not   tab.isShortcut   then

                    tab.name=tab.comment

                    Dim   col  

                    for   each   col   in   tab.columns

                        col.name=col.comment   

                    next   

              end   if             

        next

end   sub

 

 

2、name复制到comment 脚本代码

 

Option   Explicit   

ValidationMode   =   True   

InteractiveMode   =   im_Batch   

Dim   mdl      

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)   

        Dim   Tab   

        for   each   Tab   in   folder.tables   

              if   not   tab.isShortcut   then

                    tab.comment=tab.name

                    Dim   col  

                    for   each   col   in   tab.columns

                        col.comment=col.name   

                    next   

              end   if             

        next

end   sub 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics