將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

相關文章
相關標籤/搜索