1. '******************************************************************************
  2. '* File comment2name.vbs
  3. '* Author: Jason Chen
  4. '* Created: 2014
  5. '* Modified: 2017/6
  6. '* Version 2.0
  7. '* Comment: 把表中的描述信息复制为Name,增强可读性
  8. '* Used 打开物理模型,运行本脚本(Ctrl+Shift+X
  9. '* Comment:
  10. '******************************************************************************
  11.  
  12. Option Explicit
  13. ValidationMode = True
  14. InteractiveMode = im_Batch
  15.  
  16. Dim mdl ' the current model
  17.  
  18. ' get the current active model
  19. Set mdl = ActiveModel
  20. If (mdl Is Nothing) Then
  21. MsgBox "There is no current Model "
  22. ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
  23. MsgBox "The current model is not an Physical Data model. "
  24. Else
  25. ProcessFolder mdl
  26. End If
  27.  
  28. Private sub ProcessFolder(folder)
  29. On Error Resume Next
  30. Dim Tab 'running table
  31. for each Tab in folder.tables
  32. if not tab.isShortcut then
  33. tab.name = tab.code & " " & tab.comment
  34. Dim col ' running column
  35. for each col in tab.columns
  36. if col.comment="" then
  37. else
  38. dim colComment
  39. colComment = col.comment
  40. dim index
  41. dim indexArray(9) '排除掉"X"后的文本
  42. indexArray(0) = InStr(colComment, ":")
  43. indexArray(1) = InStr(colComment, vbcrlf)
  44. indexArray(2) = InStr(colComment, ":")
  45. indexArray(3) = InStr(colComment, "(")
  46. indexArray(4) = InStr(colComment, "【")
  47. indexArray(5) = InStr(colComment, "[")
  48. indexArray(6) = InStr(colComment, "(")
  49. indexArray(7) = InStr(colComment, ",")
  50. indexArray(8) = InStr(colComment, " ")
  51. index = getArrMinValueIndex(indexArray)
  52.  
  53. if index > 0 then
  54. Output index
  55. colComment = Mid(colComment, 1, index-1)
  56. end if
  57. col.name = colComment
  58. end if
  59. next
  60. end if
  61. next
  62.  
  63. Dim view '视图
  64. for each view in folder.Views
  65. if not view.isShortcut then
  66. view.name = view.comment
  67. end if
  68. next
  69.  
  70. ' go into the sub-packages
  71. Dim f ' running folder
  72. For Each f In folder.Packages
  73. if not f.IsShortcut then
  74. ProcessFolder f
  75. end if
  76. Next
  77. end sub
  78.  
  79. '查找最近一个匹配的字符
  80. Function getArrMinValueIndex(ByVal arr)
  81. Dim ix, itemMin
  82. itemMin = 0
  83. For ix = 1 To UBound(arr)
  84. If arr(ix) > 0 and (itemMin = 0 or itemMin > arr(ix)) Then
  85. itemMin = arr(ix)
  86. End If
  87. Next
  88. getArrMinValueIndex = itemMin
  89. End Function
  90.   

  

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. 直接抱过来dd大牛的《背包九讲》来做笔记

    P01: 01背包问题 题目 有N件物品和一个容量为V的背包.第i件物品的费用是c[i],价值是w[i].求解将哪些物品装入背包可使这些物品的费用总和不超过背包容量,且价值总和最大. 基本思路 这是最 ...

  2. Android:有关菜单的学习(供自己参考)

    Android:有关==菜单==的学习 上下文菜单 上下文菜单就是手机中对某一项进行==点击一定时间==后弹出的针对该项处理的菜单. context_menu.xml: <?xml versio ...

  3. 团队作业the end

    GitHub 王德钊 李镇平 陈启昌 黄益颂 汪倍民 演示动态图:为避免现场演示翻车,各个团队需要给出项目各个功能点运行的git图. 还在肝: 分工协作:团队的成员如何分工协作的?对项目的贡献如何(用 ...

  4. 团队Alpha冲刺(六)

    目录 组员情况 组员1(组长):胡绪佩 组员2:胡青元 组员3:庄卉 组员4:家灿 组员5:凯琳 组员6:翟丹丹 组员7:何家伟 组员8:政演 组员9:黄鸿杰 组员10:刘一好 组员11:何宇恒 展示 ...

  5. 福大软工1816:Alpha事后诸葛

    福大软工·第十一次作业-Alpha事后诸葛亮 组长博客链接 本次作业博客链接 项目Postmortem 模板 设想和目标 我们的软件要解决什么问题?是否定义得很清楚?是否对典型用户和典型场景有清晰的描 ...

  6. 搜索引擎Elasticsearch,了解一下?

    ElasticSearch介绍 ElasticSearch是一个全文搜索服务器,也可以作为NoSql数据库,存储任意格式的文档和数据,同时可以做大数据的分析.ElasticSearch具有以下特点: ...

  7. IBM存储降级告警等一些服务器问题/dd/ethtool

    1.IBM存储降级告警 一般两种情况 a.端口降级 例如模块16G->8G(IBM储存端口自适应) b.系统在作raid后,有硬盘损坏,降级 黄灯告警 2. dimm error dimm内存插 ...

  8. 【final】Scrum站立会议第2次....11.20

    小组名称:nice! 组长:李权 成员:于淼  刘芳芳韩媛媛 宫丽君 项目内容:约跑app(约吧) 时间:2016.11.9    12:00——12:30 地点:传媒西楼220室 本次对fnal阶段 ...

  9. (六)hadoop系列之__hadoop分布式集群环境搭建

    配置hadoop(master,slave1,slave2) 说明: NameNode: master DataNode: slave1,slave2 ------------------------ ...

  10. 对mysql联合索引中的字段进行合理排序

    在MySQL的where条件中,有时会用到很多的条件,通常为了加快速度会把这些字段放到联合索引中,可以更快的提高搜索速度: 但是对联合索引中字段顺序的合理排序,便更能提高速度 例子:select * ...