无论是cdm还是pdm都可以批量替换、处理。可在Tool-Execute commands-Edit/Run script中编辑运行脚本:

下面的脚本是批量将CDM中实体的用Code替换掉Name

Option   Explicit

ValidationMode   =   True

InteractiveMode   =   im_Batch

Dim   mdl   '当前model

'获取当前活动model

Set   mdl   =   ActiveModel

If   (mdl   Is   Nothing)   Then

MsgBox   "There   is   no   current   Model "

ElseIf   Not   mdl.IsKindOf(PdCDM.cls_Model)   Then '如果是处理pdm,这里换成PdPDM.cls_Model

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   item   '要处理的对象

for   each   item   in  folder.Entities

if   not   item.isShortcut   then             '先处理每个实体或类的Name和Code

item.name   =   item.code

'再处理每个类的属性

dim col

for   each   col   in   item.Attributes

col.name=   col.code

next

end   if

next

'最后处理关联关系

for   each   item   in  folder.relationships

if   not   item.isShortcut   then

item.name   =   item.code

end   if

next

'递归遍历子文件夹

Dim   f   '子文件夹

For   Each   f   In   folder.Packages

if   not   f.IsShortcut   then

ProcessFolder   f

end   if

Next

end   sub

////////////////////////////////////////////////////////////////////////////////////////////////////

此外,若是在pdm中可以用下面的方法遍历表或视图

Dim   Tab   'running     table  
      for   each   Tab   in   folder.tables  
            if   not   tab.isShortcut   then  
                  tab.name   =   tab.code  
                  Dim   col   '   running   column  
                  for   each   col   in   tab.columns  
                        col.name=   col.code
                  next  
            end   if  
      next 
 
      Dim   view   'running   view  
      for   each   view   in   folder.Views  
            if   not   view.isShortcut   then  
                  view.name   =   view.code  
            end   if  
      next

//////////////////////////////////////////////////////////////////////////////////////

//遍历Domian

For each dm in mdl.domains

If Not dm.isShortcut Then

If dm.code = "dm_pk" Then

Exit For

End If

End If

Next

PowerDesigner中批量替换name和code的脚本的更多相关文章

  1. (转) PowerDesigner中Table视图同时显示Code和Name

    PowerDesigner中Table视图同时显示Code和Name,像下图这样的效果: 实现方法:Tools-Display Preference

  2. SQL Server中批量替换数据

    SQL Server数据库中批量替换数据的方法 SQL Server数据库操作中,我们可能会根据某写需要去批量替换数据,那么如何批量修改替换数据呢?本文我们就介绍这一部分内容,接下来就让我们一起来了解 ...

  3. 【转】PowerDesigner中Table视图同时显示Code和Name

    为避免图片失效,文字描述, Tools-Display Preference-->左侧Table-->右下角Advanced-->左侧树Columns-->右侧上面第一个放大镜 ...

  4. linux中批量替换文本中字符串--转载

    (一)通过vi编辑器来替换.vi/vim 中可以使用 :s 命令来替换字符串.:s/well/good/ 替换当前行第一个 well 为 good:s/well/good/g 替换当前行所有 well ...

  5. Word中批量替换软回车

    在平时工作中,有时候需要拷贝一些截取自网页上的文字,当选中后拷贝到Word中时,有时候在每行的结尾出现如下的符号,,这给后期文字的整理带来了很多不便,在此记录从网上获取的解决方法,以免遗忘和便于查找. ...

  6. 在SQL SERVER中批量替换字符串的方法

    UPDATE MainData SET Content = )) , 'XM00000137' , 'XM00000078') WHERE [Key] IN (SELECT md_key FROM i ...

  7. MYSQL中批量替换某个字段的部分数据

    1.修改字段里的所有含有指定字符串的文字 UPDATE 表A SET 字段B = replace(字段B, 'aaa', 'bbb') example: update  table set url= ...

  8. PowerDesigner中Table视图同时显示Code和Name

    如题,实现如下的效果: 解决方法: 1.Tools-Display Preference 然后选中Code移到最上面

  9. mysql中批量替换数据库中的内容的sql

    经过几次系统升级,遇到域名变了,文件存储目录变了,但之前被存到数据库里了,手动改太麻烦了,下面这个sql语句太给力了,屡试不爽. update table set body = replace(bod ...

随机推荐

  1. 【bzoj5085】最大(二分+乱搞)

    题目传送门:https://www.lydsy.com/JudgeOnline/problem.php?id=5085 这道题我们可以先二分答案,然后转化为判定是否有四角权值>=mid的矩形. ...

  2. Eclipse安装SVN客户端

    在Eclipse中安装SVN客户端有个好处,不用兼容其它操作系统都能保持一致的操作.比如再Linux下SVN客户端软件体验相对较差,但是基于命令行的操作却在Linux下无所不能. 一.通过在线安装 地 ...

  3. setStyleSheet 一些QSS设置的集合

    setStyleSheet 设置的一些集合,一部分源码和截图来自 http://blog.sina.com.cn/s/articlelist_2801495241_0_1.html 1. 设置QLab ...

  4. QPushButton 响应回车 设置默认按钮

    ui.pushButton->setFocus(); //设置默认焦点 ui.pushButton->setShortcut( QKeySequence::InsertParagraphS ...

  5. JProgressBar与Timer的配套使用

    JProgressBar  的关键在于 setMaxium(int maxValue) 和 setValue(int progressValue); 当ProgressBar的当前值需要Control ...

  6. Composer 入门使用手册

    依赖管理 官网地址:http://docs.phpcomposer.com/00-intro.html#Locally Composer 不是一个包管理器.是的,它涉及 "packages& ...

  7. java:管道流(线程间管道流)

    class Send implements Runnable{ PipedOutputStream pos = null; public Send() { this.pos = new PipedOu ...

  8. Eclipse集成c与c++

    1.eclipse 开普勒版本 2.安装mingw 3.配置环境变量mingw的 path 加入;C:\MinGW\bin 4.eclipse 中的市场搜索 CDT

  9. vs2010 oraclelient 引用问题

    不能正常引用 oracleclent :错误信息如下 ================================================================= 排除1. 当前 ...

  10. Unity自带寻路Navmesh

    自带寻路Navmesh的三大组件: 1.Nav Mesh Agent:主要挂在寻路物体上 2.Off Mesh Link:实现区域转移功能(例如,有时不一定只是在地面上进行寻路,可能有些高高的平台,平 ...