Name and Comment interchange in PowerDesigner

Reproduced from: http://blog.csdn.net/xuxile/article/details/49817385

Execution method: Open PDM – Tools – Execute Commands – Run Script

Vb script code:

  1. Option Explicit
  2. < li style="border-style:none none none solid; border-left-width:3px; border-left-color:rgb(108,226,108); list-style:decimal-leading-zero outside; line-height:18px; margin :0px!important; padding:0px 3px 0px 10px!important; background-color:rgb(248,248,248)"> ValidationMode= True

  3. InteractiveMode= im_Batch
  4. Dim mdl’the current model
  5. ‘get the current active model
  6. Set mdl= ActiveModel
  7. If (mdlIsNothing) Then
  8. MsgBox “There is no current Model”
  9. ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
  10. MsgBox “The current model is not an Physical Data model.”
  11. Else
  12. ProcessFolder mdl
  13. End If
  14. ‘This routine copy name into code for each table, each column and each view
  15. ‘of the current folder
  16. Private sub ProcessFolder(folder)
  17. Dim Tab’running table
  18. for each Tab in folder.tables
  19. if not tab.isShortcut then
  20. if len(tab.comment)<>0then
  21. tab.name= tab.comment
  22. end if
  23. On Error Resume Next
  24. Dimcol’runningcolumn
  25. for each col in tab.columns
  26. if len(col.comment)<>0then
  27. col.name=col.comment
  28. end if
  29. On Error Resume Next
  30. < span style="margin:0px; padding:0px; border:none; color:black; background-color:inherit">next
  31. end if
  32. next
  33. end sub

Leave a Comment

Your email address will not be published.