PowerDesigner write comment to name and write name to comment Pd7 later version available

Source: Internet
Author: User
Tags powerdesigner

  • Code One:Copy the characters in name to comment

    Option Explicit
    Validationmode = True
    Interactivemode = Im_batch

    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

    ' This routine copy name to comment for each table, each column and each view
    ' of the current folder
    Private Sub ProcessFolder (folder)
    Dim Tab ' Running table
    For all Tab in Folder.tables
    If not Tab.isshortcut then
    Tab.comment = Tab.name
    Dim Col ' running column
    For each col in Tab.columns
    Col.comment= Col.name
    Next
    End If
    Next

    Dim View ' running view
    For each view in folder. Views
    If not View.isshortcut then
    View.comment = View.name
    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

--------------------------------------------

In addition, when using reverse engineer to reverse-generate PDM from the database, the name and code of the table in PDM are in fact code, and in order to replace name with the Chinese comment of table or column in the database, the following script can be used:

  • Code two:Copy the characters in the comment to name


    Option Explicit
    Validationmode = True
    Interactivemode = Im_batch

    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 isn't an physical Data model."
    Else
    ProcessFolder MDL
    End If

    Private Sub ProcessFolder (folder)
    On Error Resume Next
    Dim Tab ' Running table
    For all 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= "" Then
    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

-----------------------------------------------------------------------

The above two pieces of code are VB scripts, used in the PowerDesigner method is:

Powerdesigner->tools->execute Commands->edit/run Scripts

Copy the code in to execute it, it is the entire CDM or PDM operation

PowerDesigner write comment to name and write name to comment Pd7 later version available

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.