PowerDesigner16.7 installation and common configuration details

preface

Preparatory work for installation:

64 bit powerdesigner16 7: Installation file
pdflm16.dll: crack file

1, PowerDesigner installation








2, PowerDesigner cracking

Copy and overwrite "pdflm16.dll" to the root directory of the software installation.

3, Reverse Engineering (Oracle example)

Create a new model, as shown in the figure

Select the current model test Then select database - > update model from database in the menu bar

Configure data sources

ODBC configuration is cumbersome, so take JDBC as an example



Connection name: just start it
User name: database user name
Driver class: different ojdbc versions are different. This article takes ojdbc6 as an example
Connection string: jdbc:oracle:thin:@(description=(address=(protocol=tcp)(port = port) (host=IP))(connect_data=(service_name = service name))
Driver jar: specify the specific storage directory (ojdbc6 download address)

Click ok all the way and select connect. All the tables in the database will be listed. In the list, select the table model to be reverse generated.

You can select table, view and other export methods. After selection, click OK.

4, PowerDesigner common configuration

1. Display Comment comments

The default columns displayed in PowerDesigner are name and type, as shown in the following figure:

Now you need to display the Comment column to make the ER diagram clearer. However, checking the Comment display in PowerDesigner has no effect.

(1) The first method

The following steps are taken:
Double click the table to open the table properties dialog box. Switch to the ColumnTab. By default, the Comment column is displayed instead of the Comment column

Have the Comment column and supplement the Comment information

Confirm to save and open the menu Tools > display preferences

Adjust the displayed attributes

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

Open the menu Tools > execute commands > Edit / run script... Or use the shortcut key Ctrl+Shift+X to copy and paste the following code

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

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

(2) The second method

Open the menu Tools > execute commands > Edit / run script... Or use the shortcut key Ctrl+Shift+X to copy and paste the following code

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
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="" 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

After execution, you can see the change.

2. Export model table information to excel

Open the menu Tools > execute commands > Edit / run script... Or use the shortcut key Ctrl+Shift+X to copy and paste the following code

'******************************************************************************
Option Explicit
   Dim rowsNum
   rowsNum = 0
'-----------------------------------------------------------------------------
' Main function
'-----------------------------------------------------------------------------
' Get the current active model
    Dim Model
    Set Model = ActiveModel
    If (Model Is Nothing) Or (Not Model.IsKindOf(PdPDM.cls_Model)) Then
       MsgBox "The current model is not an PDM model."
    Else
      ' Get the tables collection
      'establish EXCEL APP
      dim beginrow
      DIM EXCEL, SHEET, SHEETLIST
      set EXCEL = CREATEOBJECT("Excel.Application")
      EXCEL.workbooks.add(-4167)'Add sheet
      EXCEL.workbooks(1).sheets(1).name ="Table structure"
      set SHEET = EXCEL.workbooks(1).sheets("Table structure")
      
      EXCEL.workbooks(1).sheets.add
      EXCEL.workbooks(1).sheets(1).name ="catalogue"
      set SHEETLIST = EXCEL.workbooks(1).sheets("catalogue")
      ShowTableList Model,SHEETLIST

      ShowProperties Model, SHEET,SHEETLIST
      
      
      EXCEL.workbooks(1).Sheets(2).Select
      EXCEL.visible = true
      'Set column width and wrap
      sheet.Columns(1).ColumnWidth = 20 
      sheet.Columns(2).ColumnWidth = 20 
      sheet.Columns(3).ColumnWidth = 20 
      sheet.Columns(4).ColumnWidth = 40 
      sheet.Columns(5).ColumnWidth = 10 
      sheet.Columns(6).ColumnWidth = 10 
      sheet.Columns(1).WrapText =true
      sheet.Columns(2).WrapText =true
      sheet.Columns(4).WrapText =true
      'Do not display gridlines
      EXCEL.ActiveWindow.DisplayGridlines = False
      
      
 End If
'-----------------------------------------------------------------------------
' Show properties of tables
'-----------------------------------------------------------------------------
Sub ShowProperties(mdl, sheet,SheetList)
   ' Show tables of the current model/package
   rowsNum=0
   beginrow = rowsNum+1
   Dim rowIndex 
   rowIndex=3
   ' For each table
   output "begin"
   Dim tab
   For Each tab In mdl.tables
      ShowTable tab,sheet,rowIndex,sheetList
      rowIndex = rowIndex +1
   Next
   if mdl.tables.count > 0 then
        sheet.Range("A" & beginrow + 1 & ":A" & rowsNum).Rows.Group
   end if
   output "end"
End Sub
'-----------------------------------------------------------------------------
' Show table properties
'-----------------------------------------------------------------------------
Sub ShowTable(tab, sheet,rowIndex,sheetList)
   If IsObject(tab) Then
     Dim rangFlag
     rowsNum = rowsNum + 1
      ' Show properties
      Output "================================"
      sheet.cells(rowsNum, 1) =tab.name
      sheet.cells(rowsNum, 1).HorizontalAlignment=3
      sheet.cells(rowsNum, 2) = tab.code
      'sheet.cells(rowsNum, 5).HorizontalAlignment=3
      'sheet.cells(rowsNum, 6) = ""
      'sheet.cells(rowsNum, 7) = "Table description"
      sheet.cells(rowsNum, 3) = tab.comment
      'sheet.cells(rowsNum, 8).HorizontalAlignment=3
      sheet.Range(sheet.cells(rowsNum, 3),sheet.cells(rowsNum, 7)).Merge
      'Set the hyperlink and click the table name from the directory to view the table structure
      'Field Chinese name    Field English name    Field type    notes    Primary key    Is it not empty    Default value
      sheetList.Hyperlinks.Add sheetList.cells(rowIndex,2), "","Table structure"&"!B"&rowsNum
      rowsNum = rowsNum + 1
      sheet.cells(rowsNum, 1) = "Field Chinese name"
      sheet.cells(rowsNum, 2) = "Field English name"
      sheet.cells(rowsNum, 3) = "Field type"
      sheet.cells(rowsNum, 4) = "notes"
      sheet.cells(rowsNum, 5) = "Primary key"
      sheet.cells(rowsNum, 6) = "Is it not empty"
      sheet.cells(rowsNum, 7) = "Default value"
      'Set border
      sheet.Range(sheet.cells(rowsNum-1, 1),sheet.cells(rowsNum, 7)).Borders.LineStyle = "1"
      'sheet.Range(sheet.cells(rowsNum-1, 4),sheet.cells(rowsNum, 9)).Borders.LineStyle = "1"
      'Font size is 10
      sheet.Range(sheet.cells(rowsNum-1, 1),sheet.cells(rowsNum, 7)).Font.Size=10
            Dim col ' running column
            Dim colsNum
            colsNum = 0
      for each col in tab.columns
        rowsNum = rowsNum + 1
        colsNum = colsNum + 1
          sheet.cells(rowsNum, 1) = col.name
        'sheet.cells(rowsNum, 3) = ""
          'sheet.cells(rowsNum, 4) = col.name
          sheet.cells(rowsNum, 2) = col.code
          sheet.cells(rowsNum, 3) = col.datatype
        sheet.cells(rowsNum, 4) = col.comment
          If col.Primary = true Then
        sheet.cells(rowsNum, 5) = "Y" 
        Else
        sheet.cells(rowsNum, 5) = " " 
        End If
        If col.Mandatory = true Then
        sheet.cells(rowsNum, 6) = "Y" 
        Else
        sheet.cells(rowsNum, 6) = " " 
        End If
        sheet.cells(rowsNum, 7) =  col.defaultvalue
      next
      sheet.Range(sheet.cells(rowsNum-colsNum+1,1),sheet.cells(rowsNum,7)).Borders.LineStyle = "3"       
      'sheet.Range(sheet.cells(rowsNum-colsNum+1,4),sheet.cells(rowsNum,9)).Borders.LineStyle = "3"
      sheet.Range(sheet.cells(rowsNum-colsNum+1,1),sheet.cells(rowsNum,7)).Font.Size = 10
      rowsNum = rowsNum + 2
      
      Output "FullDescription: "       + tab.Name
   End If
   
End Sub
'-----------------------------------------------------------------------------
' Show List Of Table
'-----------------------------------------------------------------------------
Sub ShowTableList(mdl, SheetList)
   ' Show tables of the current model/package
   Dim rowsNo
   rowsNo=1
   ' For each table
   output "begin"
   SheetList.cells(rowsNo, 1) = "theme"
   SheetList.cells(rowsNo, 2) = "Table Chinese name"
   SheetList.cells(rowsNo, 3) = "Table English name"
   SheetList.cells(rowsNo, 4) = "Table description"
   rowsNo = rowsNo + 1
   SheetList.cells(rowsNo, 1) = mdl.name
   Dim tab
   For Each tab In mdl.tables
     If IsObject(tab) Then
         rowsNo = rowsNo + 1
      SheetList.cells(rowsNo, 1) = ""
      SheetList.cells(rowsNo, 2) = tab.name
      SheetList.cells(rowsNo, 3) = tab.code
      SheetList.cells(rowsNo, 4) = tab.comment
     End If
   Next
    SheetList.Columns(1).ColumnWidth = 20 
      SheetList.Columns(2).ColumnWidth = 20 
      SheetList.Columns(3).ColumnWidth = 30 
     SheetList.Columns(4).ColumnWidth = 60 
   output "end"
End Sub

And automatically open the exported excel table

Keywords: powerdesigner

Added by aesir5 on Sun, 16 Jan 2022 12:43:33 +0200