将powerdesigner 中PhysicalDiagram 模型 comment字段转name

在tools --excute commonds--run/edit script...里面执行下面的代码 code

Option Explicit
Dim mdl ' the current model ip

' 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
   ProcessPkg mdl
End If ci

' This routine copy name into code for each table, each column and each view
' of the current folder
Private sub ProcessFolder(pkg)
   Dim Tab 'running  table
   Dim col
   for each Tab in pkg.tables
      ' 表注释
       if(len(tab.comment)<>0) then
       tab.name = tab.comment
       end if
      ' 表名大写
      'tab.code = Ucase(tab.code)
    if not tab.isShortcut Then         
     For each col in tab.columns
            ' 列注释
        if len(col.comment) <> 0 then   
            col.name = col. comment
          End if 
            ' 列名大写
            col.code = Ucase(col.code)
            On Error Resume Next  
     Next
    End If
    On Error Resume Next  
   Next
End sub
Private Sub ProcessPkg(mdl)
  ProcessFolder(mdl)
  Dim subpkg
   For each subpkg in mdl.packages
     ProcessPkg(subpkg)
   Next
End Sub get

相关文章
相关标签/搜索