PowerDesigner中批量替换name和code的脚本
无论是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的脚本的更多相关文章
- (转) PowerDesigner中Table视图同时显示Code和Name
PowerDesigner中Table视图同时显示Code和Name,像下图这样的效果: 实现方法:Tools-Display Preference
- SQL Server中批量替换数据
SQL Server数据库中批量替换数据的方法 SQL Server数据库操作中,我们可能会根据某写需要去批量替换数据,那么如何批量修改替换数据呢?本文我们就介绍这一部分内容,接下来就让我们一起来了解 ...
- 【转】PowerDesigner中Table视图同时显示Code和Name
为避免图片失效,文字描述, Tools-Display Preference-->左侧Table-->右下角Advanced-->左侧树Columns-->右侧上面第一个放大镜 ...
- linux中批量替换文本中字符串--转载
(一)通过vi编辑器来替换.vi/vim 中可以使用 :s 命令来替换字符串.:s/well/good/ 替换当前行第一个 well 为 good:s/well/good/g 替换当前行所有 well ...
- Word中批量替换软回车
在平时工作中,有时候需要拷贝一些截取自网页上的文字,当选中后拷贝到Word中时,有时候在每行的结尾出现如下的符号,,这给后期文字的整理带来了很多不便,在此记录从网上获取的解决方法,以免遗忘和便于查找. ...
- 在SQL SERVER中批量替换字符串的方法
UPDATE MainData SET Content = )) , 'XM00000137' , 'XM00000078') WHERE [Key] IN (SELECT md_key FROM i ...
- MYSQL中批量替换某个字段的部分数据
1.修改字段里的所有含有指定字符串的文字 UPDATE 表A SET 字段B = replace(字段B, 'aaa', 'bbb') example: update table set url= ...
- PowerDesigner中Table视图同时显示Code和Name
如题,实现如下的效果: 解决方法: 1.Tools-Display Preference 然后选中Code移到最上面
- mysql中批量替换数据库中的内容的sql
经过几次系统升级,遇到域名变了,文件存储目录变了,但之前被存到数据库里了,手动改太麻烦了,下面这个sql语句太给力了,屡试不爽. update table set body = replace(bod ...
随机推荐
- HDFS文件访问权限
HDFS中的文件访问权限 针对文件和目录,HDFS的权限模式与POSIX非常相似一共提供三类权限模式:只读权限(r).写入权限(w)和可执行权限(x).读取文件或列出目录内容时需要只读权限.写入一个文 ...
- HIVE HSQL 基本操作命令
创建表: hive>create table tablename(id int,name string,password string); 创建一个名字为tablename的表,表的属性有int ...
- Apache Phoenix的Array类型
Apache Phoenix支持JDBC ARRAY类型,任何原生的数据类型就可以在ARRAY中使用.下面我介绍一下在创建的表中使用ARRAY类型. 先看一下创建表的SQL语句: CREATE TAB ...
- [转]Android:改变Activity切换方式
overridePendingTransition(enterAnim, exitAnim); Intent intent =new Intent(this,item2.class); startAc ...
- Avoid nesting too deeply and return early避免嵌套太深应尽早返回
当某个变量与多个值进行比较的时候 不要用多个if else 判断是否相等 将多个值放在数组里,然后用PHP函数in_array(mixed $needle,array $haystack),检查数组$ ...
- C#验证类
#region 是不是中国电话,格式010-85849685 /**////<summary> /// 是不是中国电话,格式010-85849685 ///</summary> ...
- POJ - 2195 最小费用最大流
题意:每个人到每个房子一一对应,费用为曼哈顿距离,求最小的费用 题解:单源点汇点最小费用最大流,每个人和房子对于建边 #include<map> #include<set> # ...
- SpringBoot使用devtools导致的类型转换异常
遇到的问题:SpringBoot项目中的热部署引发的血的教训,报错代码位置: XStream xStream1 = new XStream(); xStream1.autodetectAnnotati ...
- 打印a*a的乘法表
/*利用for循环打印 9*9 表? 1*1=1 1*2=2 2*2=4 1*3=3 2*3=6 3*3=9 1*4=4 2*4=8 3*4=12 4*4=16 1*5=5 2*5=10 3*5=15 ...
- Codeforces Round #286 (Div. 2)A. Mr. Kitayuta's Gift(暴力,string的应用)
由于字符串的长度很短,所以就暴力枚举每一个空每一个字母,出现行的就输出.这么简单的思路我居然没想到,临场想了很多,以为有什么技巧,越想越迷...是思维方式有问题,遇到问题先分析最简单粗暴的办法,然后一 ...