- 首页 > it技术 > >
PowerDesigner|PowerDesigner 同步Name到Comment 及 同步 Comment 到Name
- 代码一:将Name中的字符COPY至Comment中
【PowerDesigner|PowerDesigner 同步Name到Comment 及 同步 Comment 到Name】OptionExplicit
ValidationMode=True
InteractiveMode=im_Batch
Dimmdl'thecurrentmodel
'getthecurrentactivemodel
Setmdl=ActiveModel
If(mdlIsNothing)Then
MsgBox"ThereisnocurrentModel "
ElseIfNotmdl.IsKindOf(PdPDM.cls_Model)Then
MsgBox"ThecurrentmodelisnotanPhysicalDatamodel. "
Else
ProcessFoldermdl
EndIf
'Thisroutinecopynameintocommentforeachtable,eachcolumnandeachview
'ofthecurrentfolder
PrivatesubProcessFolder(folder)
DimTab'runningtable
foreachTabinfolder.tables
ifnottab.isShortcutthen
tab.comment=tab.name
Dimcol'runningcolumn
foreachcolintab.columns
col.comment=col.name
next
endif
next
Dimview'runningview
foreachviewinfolder.Views
ifnotview.isShortcutthen
view.comment=view.name
endif
next
'gointothesub-packages
Dimf'runningfolder
ForEachfInfolder.Packages
ifnotf.IsShortcutthen
ProcessFolderf
endif
Next
endsub
- 代码二:将Comment中的字符COPY至Name中
OptionExplicit
ValidationMode=True
InteractiveMode=im_Batch
Dimmdl'thecurrentmodel
'getthecurrentactivemodel
Setmdl=ActiveModel
If(mdlIsNothing)Then
MsgBox"ThereisnocurrentModel "
ElseIfNotmdl.IsKindOf(PdPDM.cls_Model)Then
MsgBox"ThecurrentmodelisnotanPhysicalDatamodel. "
Else
ProcessFoldermdl
EndIf
PrivatesubProcessFolder(folder)
On Error Resume Next
DimTab'runningtable
foreachTabinfolder.tables
ifnottab.isShortcutthen
tab.name=tab.comment
Dimcol'runningcolumn
foreachcolintab.columns
if col.comment="" then
else
col.name=col.comment
end if
next
endif
next
Dimview'runningview
foreachviewinfolder.Views
ifnotview.isShortcutthen
view.name=view.comment
endif
next
'gointothesub-packages
Dimf'runningfolder
ForEachfInfolder.Packages
ifnotf.IsShortcutthen
ProcessFolderf
endif
Next
endsub
推荐阅读