2016年10月14日

PowerDesigner中NAME和COMMENT的互相转换,需要执行语句

原文:
http://www.cnblogs.com/xnxylf/p/3288718.html

由于PDM 的表中 Name 会默认=Code 所以很不方便, 所以需要将 StereoType 显示到表的外面来

打开[工具]->[显示属性](英文:Display Preferences) ->Content->Table->右边面板Columns框中 勾选: StereoType ,这样再在 StereoType中填入code字段相同内容就会显示在图形界面上了

 

使用说明: 在【Tools】-【Execute Commands】-【Edit/Run Script】 下。输入下面你要选择的语句即可,也可以保存起来,以便下次使用,后缀为.vbs。

 需要注意的问题是:运行语句时必须在Module模式下,如果是导出报表时执行会出现错误提示。

1.Name转到Comment注释字段。一般情况下只填写NAME,COMMENT可以运行语句自动生成。

将该语句保存为name2comment.vbs

原地址的代码有一些格式上的错误,现已修正。 

 

 

'把pd中那么name想自动添加到comment里面
'如果comment为空,则填入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 

'   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
                     if  trim(tab.comment)="" then'如果有表的注释,则不改变它.如果没有表注释.则把name添加到注释里面.
                        tab.comment   =   tab.name
                     end if  
                  Dim   col   '   running   column    
                  for   each   col   in   tab.columns   
                        if trim(col.comment)="" then '如果col的comment为空,则填入name,如果已有注释,则不添加;这样可以避免已有注释丢失.
                           col.comment=   col.name   
                        end if 
                  next    
            end   if    
      next    
  
      Dim   view   'running   view    
      for   each   view   in   folder.Views    
            if   not   view.isShortcut and trim(view.comment)=""  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 
 

 

 

 

2.将Comment内容保存到NAME中,comment2name.vbs 实习互换。语句为:

 

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 

posted @ 2016-10-14 09:51 天都灰了 阅读(201) 评论(0) 推荐(0)

2016年4月6日

Mysql主从配置

摘要: MySQL的Replication是一种多个MySQL的数据库做主从同步的方案,特点是异步,广泛用在各种对MySQL有更高性能,更高可靠性要求的场合。 Replication原理 Mysql 的 Replication 是一个异步的复制过程,从一个MySQL节点(称之为Master)复制到另一个My 阅读全文

posted @ 2016-04-06 16:38 天都灰了 阅读(223) 评论(0) 推荐(0)

2016年3月21日

SSO单点登录(转载)

摘要: 昨天和几位朋友探讨到了这个话题,发现虽然单点登录,或者叫做独立的passport登录虽然已经有了很多实现方法,但是能真正了解并实现的人却并不太多,所以些下此文,希望从原理到实现,能让大家了解的多一些 至于什么是单点登录,举个例子,如果你登录了msn messenger,访问hotmail邮件就不用在 阅读全文

posted @ 2016-03-21 16:38 天都灰了 阅读(276) 评论(0) 推荐(0)

2016年1月6日

windows----composer、laravel安装

摘要: 环境要求:php+apache,并且将php的根目录配置到“环境变量”。1.安装composer使用cmd进入想要安装composer的目录执行如下命令,下载composer.phar文件:php -r "readfile('http://install.phpcomposer.com/instal... 阅读全文

posted @ 2016-01-06 12:52 天都灰了 阅读(339) 评论(0) 推荐(0)

2014年9月12日

转载:EntityFramework 6.0< Code First > 连接 Mysql数据库

摘要: 转载自:http://blog.csdn.net/kmguo/article/details/19650299网上有很多关于用EntityFrame来连接Mysql数据库的教程,可是很多并不靠谱,转载的太多了。找了很久,总算是配置好了,现在分享一下。一,安装: 1、开发环境: VS2013与EF6... 阅读全文

posted @ 2014-09-12 18:10 天都灰了 阅读(243) 评论(0) 推荐(0)

2014年7月2日

Win7 64位 php+Apache+mysql 配置

摘要: 注明:此文转载至 http://www.cnblogs.com/isyouth/p/3778045.html 一 :准备阶段 1:php php下载链接:http://windows.php.net/download。 php non thread safe 和 php thread safe 的区 阅读全文

posted @ 2014-07-02 10:21 天都灰了 阅读(574) 评论(0) 推荐(0)

2014年6月24日

java 使用pem密钥进行RSA加解密

摘要: 1.使用openssl生成私钥和公钥 openssl下载地址:http://www.openssl.org/source openssl生成私钥命令: genrsa -out rsa_private_key.pem 1024 openssl生成公钥命令: rsa -in rsa_private_ke... 阅读全文

posted @ 2014-06-24 15:29 天都灰了 阅读(7325) 评论(0) 推荐(0)

2014年3月12日

Zend Framework 框架搭建

摘要: 通过手工方法搭建Zend Framework的MVC框架结构。首先看一下zend framework mvc的目录结构 1. 在根目录下面创建 public ,并在 public 下创建 index.php引导文件。代码如下:bootstrap()->run();2. 在 public 目录下创建URL重写文件 .htaccess,代码如下:RewriteEngine onRewriteRule!\.(js|ico|gif|jpg|png|css)$ index.php将不能映射到磁盘上的文件都重定向至 index.php3. Zend Framework 配置信息保存在扩展名为.ini 阅读全文

posted @ 2014-03-12 16:36 天都灰了 阅读(1740) 评论(0) 推荐(0)

2013年11月21日

log4net使用详解

摘要: 转载至:http://blog.csdn.net/zhoufoxcn/article/details/2220533说明:本程序演示如何利用log4net记录程序日志信息。log4net是一个功能著名的开源日志记录组件。利用log4net可以方便地将日志信息记录到文件、控制台、Windows事件日志和数据库(包括MS SQL Server, Access, Oracle9i,Oracle8i,DB2,SQLite)中。并且我们还可以记载控制要记载的日志级别,可以记载的日志类别包括:FATAL(致命错误)、ERROR(一般错误)、WARN(警告)、INFO(一般信息)、DEBUG(调试信息)。要 阅读全文

posted @ 2013-11-21 12:06 天都灰了 阅读(252) 评论(0) 推荐(0)

2013年3月6日

使用PowerDesigner 15对现有数据库进行反向工程(图解教程)(转)

摘要: 1、启动PD2、菜单:File->Reverse Engineer ->Database 出来New Physical Data Model对话框点击“确定”按钮,弹出Database Reverse Engineering Options对话框:在此我们选择Using a data source,点击数据源按钮弹出Connection to a Data Source对话框,在下拉框中选择我们之前建立的数据源,并输入User ID和password点击Connection即可连接至数据库,并得取所有的数据库对象,在此我们选择所有的Table。最后点击OK,大功告成!!,以下为部分 阅读全文

posted @ 2013-03-06 15:02 天都灰了 阅读(380) 评论(2) 推荐(0)

导航

< 2025年6月 >
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 1 2 3 4 5
6 7 8 9 10 11 12
点击右上角即可分享
微信分享提示