powerdesign中表的name和comment互换

来源:互联网 发布:ibm人工智能 鲍勃迪伦 编辑:程序博客网 时间:2024/06/17 08:25

1 PowerDesigner中批量根据对象的name生成comment的脚本

执行方法:Open PDM -- Tools -- Execute Commands -- Run Script

Option ExplicitValidationMode = TrueInteractiveMode = im_BatchDim mdl 'the current model'get the current active modelSet mdl = ActiveModelIf (mdl Is Nothing) ThenMsgBox "There is no current Model"ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) ThenMsgBox "The current model is not an Physical Data model."ElseProcessFolder mdlEnd If'This routine copy name into code for each table, each column and each view'of the current folderPrivate sub ProcessFolder(folder)Dim Tab 'running tablefor each Tab in folder.tablesif not tab.isShortcut thentab.comment = tab.nameDim col 'running columnfor each col in tab.columnscol.comment= col.namenextend ifnextDim view 'running viewfor each view in folder.Viewsif not view.isShortcut thenview.comment = view.nameend ifnext'go into the sub-packagesDim f 'running folderFor Each f In folder.Packagesif not f.IsShortcut thenProcessFolder fend ifNextend sub


2 PowerDesigner中逆向工程将数据库中comment脚本赋值到PDM的name

执行方法:Open PDM -- Tools -- Execute Commands -- Run Script

Option ExplicitValidationMode = TrueInteractiveMode = im_BatchDim mdl 'the current model'get the current active modelSet mdl = ActiveModelIf (mdl Is Nothing) ThenMsgBox "There is no current Model"ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) ThenMsgBox "The current model is not an Physical Data model."ElseProcessFolder mdlEnd If'This routine copy name into code for each table, each column and each view'of the current folderPrivate sub ProcessFolder(folder)Dim Tab 'running tablefor each Tab in folder.tablesif not tab.isShortcut thenif len(tab.comment) <> 0 thentab.name = tab.commentend ifOn Error Resume NextDim col 'running columnfor each col in tab.columnsif len(col.comment) <>0 thencol.name =col.commentend ifOn Error Resume Nextnextend ifnextend sub





0 0
原创粉丝点击