The PowerDesigner view displays Comment comments

Posted by dig412 on Sat, 28 Dec 2019 19:50:58 +0100

Hyperlink of the original text, blogger address: http://blog.csdn.net/difffate. https://blog.csdn.net/difffate/article/details/77945239

The default columns displayed by PowerDesigner are Name and type, as shown below:

Now you need to show the Comment column to make the ER diagram clearer. However, checking Comment in PowerDesigner has no effect, so it can be handled in the following steps:

Double click the table to open the table property dialog box, and switch to ColumnTab. By default, no Comment is displayed. The Comment column is displayed. Do this

Set display Comment

With the Comment column, add the Comment information

OK to save, open the menu Tools > display preferences

Adjust the displayed Attribute

OK, save, OK, exit the settings page, apply it to all identifications, and you can see the table changes

Next, we need to execute the VBS script, learn from the script on the network, and improve the following to deal with the situation where Comment is empty

 Option   Explicit   
    ValidationMode   =   True   
    InteractiveMode   =   im_Batch
    Dim blankStr
    blankStr   =   Space(1)
    Dim   mdl   '   the   current   model  
      
    '   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   
          ProcessFolder   mdl   
    End   If  
      
    Private   sub   ProcessFolder(folder)   
    On Error Resume Next  
          Dim   Tab   'running     table   
          for   each   Tab   in   folder.tables   
                if   not   tab.isShortcut   then   
                      tab.name   =   tab.comment  
                      Dim   col   '   running   column   
                      for   each   col   in   tab.columns   
                      if col.comment = "" or replace(col.comment," ", "")="" Then
                            col.name = blankStr
                            blankStr = blankStr & Space(1)
                      else  
                            col.name = col.comment   
                      end if  
                      next   
                end   if   
          next  
      
          Dim   view   'running   view   
          for   each   view   in   folder.Views   
                if   not   view.isShortcut   then   
                      view.name   =   view.comment   
                end   if   
          next  
      
          '   go   into   the   sub-packages   
          Dim   f   '   running   folder   
          For   Each   f   In   folder.Packages   
                if   not   f.IsShortcut   then   
                      ProcessFolder   f   
                end   if   
          Next   
    end   sub

 

Open the menu Tools > execute commands > Edit / run Script

 

After execution, you can see the comments displayed in the third column, ha ha. The effect is as follows

The principle is to replace the value of the column displaying name with the value of the comment, so if you adjust the comment next time, you have to execute the script again, so it's better to put it in the last execution.

Topics: Attribute network