'******************************************************************************
'* 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. python基础-02-while格式化逻辑运算

    python其他知识目录 1.循环打印“我是小马过河” while True:    print('我是小马过河') #4.用while从一打印到10 #5.请通过循环,1 2 3 4 5 6 8 9 ...

  2. hbase优化操作与建议

    一.服务端调优 1.参数配置 1).hbase.regionserver.handler.count:该设置决定了处理RPC的线程数量,默认值是10,通常可以调大,比如:150,当请求内容很大(上MB ...

  3. 关于XML文档操作类

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

  4. 用VS测试程序

    怀着一种忐忑的心情,我开始了我的软件测试. #include "stdio.h" #include "stdlib.h" int main(int argc, ...

  5. myeclipse生成类的帮助文档

    http://blog.csdn.net/tabactivity/article/details/11807233

  6. CentOS 7 安装 MySql 8

    1-安装 CentOS 7   2-安装 NETCORE SDK      SDK 安装文档:https://dotnet.microsoft.com/download/linux-package-m ...

  7. 3dContactPointAnnotationTool开发日志(二六)

      之前给老师看了看我的毕设,老师觉得操作太复杂了,要能像3ds max里那样可以拖动物体的轴进行平移,沿着显示的圆圈旋转以及缩放啥的.说白了就是在Unity3d的Game视图显示出Scene视图里的 ...

  8. spring学习12 -Spring 框架模块以及面试常见问题注解等

    以下为spring常见面试问题: 1.Spring 框架中都用到了哪些设计模式? Spring框架中使用到了大量的设计模式,下面列举了比较有代表性的: 代理模式—在AOP和remoting中被用的比较 ...

  9. 在python3中使用urllib.request编写简单的网络爬虫

    转自:http://www.cnblogs.com/ArsenalfanInECNU/p/4780883.html Python官方提供了用于编写网络爬虫的包 urllib.request, 我们主要 ...

  10. 第87天:HTML5中新选择器querySelector的使用

    一.HTML5新选择器 1.document.querySelector("selector");selector:根据CSS选择器返回第一个匹配到的元素,如果没有匹配到,则返回n ...