comment2name.vbs

来自「利用PowerDesinger数据字典制作」· VBS 代码 · 共 57 行

VBS
57
字号
'功能:
'**表示主键字段  *表示非空字段
'每列加上序号(有时不同的字段comment可能相同)

Option Explicit
ValidationMode = True
InteractiveMode = im_Batch

Dim mdl 

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)
   Dim Tab,rr
   rr=0
   for each Tab in folder.tables
      rr=rr+1
      if not tab.isShortcut then
         if (not isnull(tab.comment)) and (trim(tab.comment)<>"") then
           tab.name = tab.comment        
         end if
         Dim col,r 
         r=0
         for each col in tab.columns
         r=r+1
         if (not isnull(col.comment)) and  (trim(col.comment)<>"")   then
            col.name=col.comment
            '**表示主键字段  *表示非空字段
            if (Col.Mandatory="True") then
               col.name="*"+col.name
                col.code="*"+col.code
            end if
            if (Col.Primary="True") then
               col.code="*"+col.code
            end if            
            
         end if
         next
      end if
   next
   Dim view
   for each view in folder.Views
      if not view.isShortcut then
         if (not isnull(view.comment)) and (trim(view.comment)<>"") then
            view.name = view.comment
         end if
      end if
   next   
end sub
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?