'******************************************************************************
'* File: comment2name.vbs
'* Author: Jason Chen
'* Created: 2014
'* Modified: 2017/6
'* Version: 2.0
'* Comment: 把表中的描述信息复制为Name,增强可读性
'* Used: 打开物理模型,运行本脚本(Ctrl+Shift+X)
'* Comment:
'****************************************************************************** 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.code & " " & tab.comment
Dim col ' running column
for each col in tab.columns
if col.comment="" then
else
dim colComment
colComment = col.comment
dim index
dim indexArray(9) '排除掉"X"后的文本
indexArray(0) = InStr(colComment, ":")
indexArray(1) = InStr(colComment, vbcrlf)
indexArray(2) = InStr(colComment, ":")
indexArray(3) = InStr(colComment, "(")
indexArray(4) = InStr(colComment, "【")
indexArray(5) = InStr(colComment, "[")
indexArray(6) = InStr(colComment, "(")
indexArray(7) = InStr(colComment, ",")
indexArray(8) = InStr(colComment, " ")
index = getArrMinValueIndex(indexArray) if index > 0 then
Output index
colComment = Mid(colComment, 1, index-1)
end if
col.name = colComment
end if
next
end if
next Dim 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 '查找最近一个匹配的字符
Function getArrMinValueIndex(ByVal arr)
Dim ix, itemMin
itemMin = 0
For ix = 1 To UBound(arr)
If arr(ix) > 0 and (itemMin = 0 or itemMin > arr(ix)) Then
itemMin = arr(ix)
End If
Next
getArrMinValueIndex = itemMin
End Function
  

  

powerdesigner中把表的描述复制到Name的更多相关文章

  1. SQL SERVER 将一个数据库中的表和数据复制到另一个数据库中

    第一种情况:将A数据库.dbo.A表的数据追加到B数据库.dbo.B表中 (条件:此时B数据库中已创建好了B表) insert into B数据库.dbo.B表 select * from A数据库. ...

  2. 反向读取Mysql数据库表结构到PowerDesigner中

    使用PowerDesigner挺长时间了,只是一些简单的表结构设计,因需要对当前数据库进行再设计,需要看一下数据库中所有的表,及表之间的关系,并重新修改表结构,因此需求就是怎么把数据库中的表结构反向生 ...

  3. 使用PowerDesigner创建物理模型并生成SQL语句在MySQL中生成表

    我使用的PowerDesigner的版本为16.5,创建物理模型后,使用PowerDesigner生成的SQL语句,在MySQL中创建表. 1. 打开Power Designer软件,在弹出的欢迎对话 ...

  4. sql 2012中获取表的信息,包含字段的描述

    1.获取数据库中的表 select name from sysobjects where type='U' 2.获取表字段(此处是Route表) Select name from syscolumns ...

  5. python生成数据库中所有表的DESC描述

    在数据库设计完成之后, 常常需要在 wiki 或其他文档中保存一份数据库中所有表的 desc 描述, 尤其是每个字段的含义和用途. 手动去生成自然是不可取的. 因此, 我编写了一个简单的 python ...

  6. PowerDesigner中创建Oracle表全过程记录

    本文记录如何在PowerDesigner中创建一个Oracle结构的表. 在进行本文阅读之前,需要在PowerDesigner进行 DBMS修改,DataBase创建,用户创建,表空间创建.   1. ...

  7. PowerDesigner中在生成的数据库脚本中用name列替换comment列作为字段描述的方法

    1 PowerDesigner中在生成的数据库脚本中用name列替换comment列作为字段描述的方法如下, 依次打开Tools -- Execute Commands -- Run Script,运 ...

  8. oracle 表导入到powerDesigner 中

    最近不忙,之前一直是用powerDesigner看表结构,还没自己导入过,今天试试 oracle 表导入到powerDesigner 中步骤: 1.File--->reverse Enginne ...

  9. 利用脚本将EXCEl表倒入PowerDesigner中

    1.Excel表格样式 2.脚本代码 '****************************************************************************** O ...

随机推荐

  1. SpringMVC Controller介绍及常用注解——@Controller

    一 在SpringMVC 中,控制器Controller 负责处理由DispatcherServlet 分发的请求,它把用户请求的数据经过业务处理层处理之后封装成一个Model ,然后再把该Model ...

  2. 关于XML文档操作类

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.X ...

  3. scrum立会报告+燃尽图(第三周第三次)

    此作业要求参见:https://edu.cnblogs.com/campus/nenu/2018fall/homework/2286 项目地址:https://coding.net/u/wuyy694 ...

  4. POJ2528的另一种解法(线段切割)

    题目:Mayor's posters 原文地址 首先本题题意是:有一面墙,被等分为1QW份,一份的宽度为一个单位宽度.现在往墙上贴N张海报,每张海报的宽度是任意 的,但是必定是单位宽度的整数倍,且&l ...

  5. 关于Filter的一点误解

    之前一直以为请求达到Web应用时,经过过滤器1,过滤器2……,处理后产生响应再经过过滤器n……过滤器2,过滤器1.这样的阐述似乎没有问题,但我的理解却有问题.比如过滤器1的doFilter方法执行了一 ...

  6. 如何给一块新硬盘安装grub,让它成为一个只有一个内核的系统

    (1)先关机 (2)添加一块硬盘 (3)将硬盘分区,/dev/sdb1为boot分区,/dev/sdb2为swap分区, /dev/sdb3为根分区 (4)调整/dev/sdb2的分区类型为82,指定 ...

  7. 对IT行业的一些思考

          阅读完两篇报道,从“2014年十大最热门行业和职业排行榜”可以看出最热门的行业是IT行业,可以看出IT行业在未来的发展前景很乐观,选择IT行业的人也会越来越多,IT行业也会越来越庞大.但是 ...

  8. PHP 多文件打包下载 zip

    <?php $zipname = './photo.zip'; //服务器根目录下有文件夹public,其中包含三个文件img1.jpg, img2.jpg, img3.jpg,将这三个文件打包 ...

  9. py27使用redis

    1.安装redis pip install redis 转载请注明博客出处:http://www.cnblogs.com/cjh-notes/

  10. postman优缺点

    postman优缺点分析 优点:门槛低,上手快 优点: 脚本语言是js 优点:自带各种代码模块 优点:跨平台 优点: 免费版就已经非常强大了,支持http,https协议 优点:有命令行版本,newm ...