无论是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. java深入探究14-lucene

    项目代码:链接:http://pan.baidu.com/s/1qXVcfCw 密码:apw1 01 回顾索引 定义:索引是对数据库表中一列或多列的值进行排序的一种结构 目的:加快对数据库表中记录的查 ...

  2. BZOJ3241/UOJ125 [Noi2013]书法家

    本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/ ...

  3. R语言:导入导出数据

    主要学习如何把几种常用的数据格式导入到R中进行处理,并简单介绍如何把R中的数据保存为R数据格式和csv文件. 1.保存和加载R的数据(与R.data的交互:save()函数和load()函数) a & ...

  4. jsp: jstl标签库 uri标签

    与 URL 相关的标签主要是用来将其他文件包含进来,或者提供页面之间的重定位以及 URL 地址的生成.参数的输出等等.一般包括如下几个标签<c:import>标签:与传统 JSP 页面中的 ...

  5. 2017-02-23 .NET Core Tools转向使用MSBuild项目格式

    微软之前为了让.NET Core和ASP.NET Core能够支持Windows Visual Studio之外的开发平台,创建了基于project.json格式的项目系统.不过可惜,这种格式与之前的 ...

  6. ComboBoxStyle和ToggleButton

    <Style x:Key="ComboBoxStyle" TargetType="{x:Type ComboBox}">   <Setter ...

  7. asp.net中异步调用webservice

    WebService方法是不需要作任何修改的,只是在调用时采用异步的方式,这样在循环中,速度会显得快一点. 原来的方式: HotelMagWeb.com.china_sms.www.MainServi ...

  8. python中模块的引用

    一. 模块的定义 定义 python模块(Module),是一个python文件,以.py结尾,包含了python对象定义和python语句.模块让你能够有逻辑地组织你的python代码段,把相关的代 ...

  9. java 简单解析wsdl

    static void resolve(String wsdl) throws Exception { DocumentBuilderFactory factory = DocumentBuilder ...

  10. swagger 在apache CXF 中的使用——JAX-RS Swagger2Feature

    The CXF Swagger2Feature allows you to generate Swagger 2.0 documents from JAX-RS service endpoints w ...