PowerDesigner Show Comments

Source: Internet
Author: User
Tags powerdesigner

Version 12:
1, in the ER diagram mode, to increase the display of the Commit property
2, tools to add a VBS script, you can replace the name content with the content of comments

Version 15:
Tools->display Preferences->content->table->advanced...->columns->select


When code is selected, move it up to the first bit


This allows you to display the code, name, type three items in the ER diagram, and then run the script to replace the contents of the comment comment in code or name.

VBS file Contents:
‘******************************************************************************
' * File:comment2code.vbs
' * Purpose: Display Chinese annotation of data column in PowerDesigner's PDM graphics window
' * Title: Assigns the field's comment to the field's code
' * Category: Open physical model, run this script (ctrl+shift+x)
' * Copyright:[email PROTECTED],2006/07/25.
' * Author:foxzz
' * Created:
' * Modified:
' * version:1.0
' * Comment: Iterates through all the tables in the physical model, assigning the field's Comment to the field's code.
' Issues to be considered in the process of replacing code with comment
' 1, code must be unique, and comment may not be unique.
' The deal is if the field's comment is repeated, then the field is Code=comment+1, 2, 3 ...
' 2, the comment value may be empty, in which case the code for the field is not handled.
' For Oracle database, comment on column field name is '; added to the C:\pdcomment.txt file.
' After the supplemental comment is complete, it is easy to execute in the database
‘******************************************************************************

Option Explicit
Validationmode = True
Interactivemode = Im_batch

Dim system, File
Set system = CreateObject ("Scripting.FileSystemObject")
Dim ForReading, ForWriting, forappending ' Open file options
ForReading = 1 ' Read only
ForWriting = 2 ' writable
ForAppending = 8 ' writable and append
' Open Text file
Set file = System. OpenTextFile ("C:\pdcomment.txt", ForWriting, True)


' Determine if the current model is a physical data
Dim MDL
Set mdl = Activemodel
If (MDL is Nothing) then
MsgBox "Processing object No Model"
ElseIf not MDL. IsKindOf (Pdpdm.cls_model) Then
MsgBox "The current model is not a physical data model"
Else
ProcessFolder Mdl,file
End If
File. Close


‘******************************************************************************
Private Sub ProcessFolder (folder,file)

Dim i,j,k
I=0:j=0:k=0

' Column array, the record field does not repeat the comment
Dim columncomment ()
Dim Columncommentnumber ()
ReDim Preserve columncomment (i)
ReDim Preserve Columncommentnumber (i)

Dim tbl ' current table
Dim Col ' current field
Dim curcomment ' Current Field comment

' Working with tables in the model
For each tbl in Folder.tables
If not Tbl.isshortcut then
If Len (Trim (tbl.comment)) <>0 Then
' You can show the table's comment here
' Tbl.code = Tbl.code+ ' ("+trim (tbl.comment) +") "
End If

' Working with columns in a table
For each col in Tbl.columns
K = 0
Curcomment = Trim (col.comment)
If Len (curcomment) <>0 Then
' Traverse a different comment array
For j = 0 to I
If Columncomment (j) = Curcomment Then
' If the same comment is found, the relevant counter plus 1
Columncommentnumber (j) = Columncommentnumber (j) + 1
K = J
End If
Next
' If there is no same comment, then k=0, at this time Columncommentnumber (0) is also 0
' Otherwise columncommentnumber (k) is not 0
If Columncommentnumber (k) <> 0 Then
Col.code = curcomment & CStr (Columncommentnumber (k))
Else
Col.code = Curcomment
' Columncomment (0), Columncommentnumber (0) are always empty
' Add a different comment record to the array
i = i + 1
ReDim Preserve columncomment (i)
ReDim Preserve Columncommentnumber (i)
Columncomment (i) = Curcomment
Columncommentnumber (i) = 0
End If
Else
' Write in File
File. WriteLine "comment on column" + tbl.code+ "." +col.code+ "is"; "
End If
Next
End If
' Because the code for the different tables is allowed to be the same, it is reinitialized at this time.
' Because Columncomment (0), Columncommentnumber (0) are empty, you can keep
ReDim Preserve columncomment (0)
ReDim Preserve columncommentnumber (0)
I=0:j=0:k=0

Next

Dim View ' Current view
For each view in folder. Views
If not View.isshortcut then
' You can show the comment of the view here
' View.code = view.comment
End If
Next

' Recursively recursive to subdirectories
Dim subpackage ' folder
For each subpackage in folder. Packages
If not subpackage. Isshortcut Then
ProcessFolder subpackage, File
End If
Next

End Sub

PowerDesigner Show Comments

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.