I answer a lot of questions on the SAP Community Network; a couple of years ago, a user wanted to know how to display the object codes on her diagrams instead of the object names. In PowerDesigner every object has both a Code and a Name – the Name is what it’s known as inside PowerDesigner, and the Code is what it’s known as outside PowerDesigner. In a Physical Data Model, for example, the Name of a table might be “Customer Account”, and the Code might be “CUST_ACCT” – in this case the table name is also the name of the Logical Data Model entity that the table was generated from. PowerDesigner has derived the Code from the model’s naming standards.
By default, PowerDesigner diagrams (and the Browser window) always show the object names; for a Physical Data Model (PDM), this could include:
- Tables and Columns
- Views and View Columns
For example, here’s a sample PDM diagram showing the object Names, and the corresponding list of objects in the Browser:
The advantage of this view from my perspective, is that the names on show are descriptive, unencumbered by any restrictions imposed by the DBMS or local naming standards – I know what every column name means. The name of the bottom reference in the diagram was copied across from the LDM, the two called “Inheritance_1” were generated from an inheritance (super/sub-type) hierarchy.
The disadvantage of this view is that it doesn’t show the names used for the objects in the database. Those names are actally there, in the object definitions, in the Code property:
I’m sure that the vast majority of people who work with Physical Data Models would prefer to show the object codes on the Diagram, like this:
It’s really easy to change the view from Names to Codes; exactly how you do it depends on your version of PowerDesigner. The original method is by selecting ‘Code’ in the Naming Conventions in Model Options:
The setting applies to every diagram in the model, and also affects the Browser content.
In PowerDesigner 16.6, the setting was moved to the Display Preferences for the Diagram, though it still affects the whole model, including the Browser. Also, a new tool was introduced on the Standard toolbar – – now you can toggle between displaying names or codes with a single click.
If you want to show both Names and Codes on diagrams, you can do this for individual diagrams via Display Preferences. The ability to customise the content of symbols is one of the features that helps PowerDesigner to stand out in comparison to ERwin Data Modeller and ER/Studio Data Architect. For example, here’s a table symbol that focuses on the table and column codes, but also shows the names for those objects:
The Code is not available for display by default, so you’ll have to use the Advanced features to make it available. Right-click the diagram background, select Display Preferences, and select ‘Table’ on the left.
Here’s where you choose what to display on Tables, based on the properties that SAP have made available. You’ll see that you can choose ‘Name’ or ‘Owner and Name’, but not ‘Code’. All is not lost, however, as we can make other properties available to display – just click on the Advanced button at the bottom right.
Now you can select what you want the user to be able to display on table symbols. You can move things around, add and remove things, and change the way they’re organised. Here’s the default view:
In this case, you want to make the Code visible. To do this, click on the ‘Add Attribute’ button, select ‘Code’ from the list of Attributes, and press <OK>. You will see more attributes than my clip shows, I’ve cropped the image.
Here’s my customised view, in which I’ve removed and added content, and amended the layout – notice the prefix and suffix for the Name:
I’ve changed the displayed content (a.k.a. ‘List columns’) for the Columns in each Table, making sure that it shows the code and then the name of each column:
I won’t show all the steps needed to reproduce my table symbol, due to lack of space; besides, I have to let you work out something for yourself, I can’t take away all the challenge for you.
You can apply these settings to other diagrams as well, just click on the ‘Apply To’ button in Display Preferences. Beware, this will apply all the current Display Preferences to the selected diagrams.
One last point – you can change the content of individual symbols – just right-click the symbol, slect ‘Format’, then click on the ‘Content’ tab:
In this version of my diagram, every table symbol has different content: