PowerDesigner 中将Comment(注释)及Name(名称)内容互相COPY的VBS代码
在用PowerDesigner时.常常在NAME或Comment中写中文在Code中写英文.Name只会显示给我们看,Code会使用在代码中.但Comment中的文字会保存到数据库TABLE的Description中,有时候我们写好了Name再写一次Comment很麻烦.以下两段代码就可以解决这个问题.
代码一:将Name中的字符COPY至Comment中
'******************************************************************************
'* File: name2comment.vbs
'* Purpose: Database generation cannot use object names anymore
' in version 7 and above.
' It always uses the object codes.
'
' In case the object codes are not aligned with your
' object names in your model, this script will copy
' the object Name onto the object Comment for
' the Tables and Columns.
'
'* Title:
'* Version: 1.0
'* Company: Sybase Inc.
'******************************************************************************
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中的字符COPY至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->Tools->Execute Commands->Edit/Run Scripts
分享到:
相关推荐
Powerdesigner 使用技巧
PowerDesigner一些使用技巧 网上找到的一些资源,给大家分享下!
PowerDesigner设计技巧。。。PowerDesigner设计技巧。。。PowerDesigner设计技巧。。。PowerDesigner设计技巧。。。
powerdesigner进行相关物理数据模型的使用技巧的操作说明
前言 一、创建概念数据模型 二、概念模型转为物理模型 三、创建物理数据模型 四、导出建库SQL脚本 五、导出数据库设计文档 1.使用向导生成数据字典文档 2.使用已有模板生成数据...2.PowerDesigner使用name生成comment
是本人在设计数据库时整理出来的powerdesigner资料
powerDesigner的常用配置及使用技巧 + idea注释模板配置
PowerDesigner最初由Xiao-Yun Wang(王晓昀)在SDP Technologies公司开发完成。PowerDesigner是Sybase的企业建模和设计解决方案,采用模型驱动方法,将业务与IT结合起来,可帮助部署有效的企业体系架构,并为研发...
PowerDesigner技巧集1_7
PowerDesigner12.5入门及技巧
PowerDesigner一些小技巧 2、由pdm生成建表脚本时,字段超过15字符就发生错误(oracle) 3、生成的建表脚本中如何把对象的双引号去掉? 4、建立一个表后,为何检测出现Existence of index的警告 5、创建一个表在...
调色板(Palette)快捷工具栏不见了;如何把NAME 列在 scrip里显示出来;自增长列的设置;设置CDM生成PDM时的错误检查;禁止根据name自动输入code等
PowerDesigner中文版学习心得,它是一部分技巧的集合,有待完善,可以让使用中文版的同学有所了解
介绍了PD的很多基本功能 PowerDesigner UML 建模简介 PowerDesigner的模块组成 PowerDesigner开发技巧与使用 等等
PowerDesigner中批量根据对象的name生成comment的脚本 PowerDesigner中逆向工程将数据库中comment脚本赋值到PDM的name
PowerDesigner 循序渐进教程,写设计文档的利器,系统介绍PowerDesigner 入门及各项技巧 包括: 1、PowerDesigner 入门基础 2、PowerDesigner 培训讲座 3、PowerDesigner 教程系列 4、PowerDesigner数据库建模技术
使用POWERDESIGNER设计数据库的20条技巧
本书系统地介绍了使用PowerDesigner 6.1 进行数据库建模的方法与 技巧。 全书内容包括:PowerDesigner 建模环境,PowerDesigner 简介, MetaWorks 模块,DataArchitect 模块,概念数据模型的建立、完善、检查、 固化...
开发技巧经验 主要是一些开发中常用工具的安装说明,包括ArcGis Server 安装说明、jdk安装说明、SQL SERCER2012安装说明、Tomcat安装说明、windows 7 设置程序自动启动、windows2013 设置程序自动启动、使用...