Adding existing relationships to a diagram in PowerDesigner

I remember the first time I came across Sybase PowerDesigner. It was version 12, re-badged by Quest Software as QDesigner. I had multiple ERDs in my CDM, and I wanted to include existing relationships on a new ERD I was putting together. I was used to a command in Oracle Designer that would add all missing relationships (including inheritances) to the diagram – every existing relationship that connects two entities that already appear on the diagram would be included. After a search, I found the equivalent command in PowerDesigner. However, I often just wanted to include selected relationships on the diagram, so I tried dragging them onto the diagram from the browser. I was really annoyed at the result, and took a while to understand what was going on, and I know I wasn’t the only one. I don’t think it’s a problem with PowerDesigner really, but a symptom of the fact that it doesn’t always work in the same way as other tools.

The confusion still exists today, as evidenced by a recent thread on the Info Advisors PD group – “Even when dragging a relationship / reference from the browser into a diagram where the participating entities have already been included as symbols, PD creates new symbols for them, rather than connect the relationship’s symbol to the existing entities’ symbols. One has to manually delete the extra ones; a nuisance...”.

When you drag a relationship onto a diagram from the browser, PD will automatically include the two entity symbols as well, even if the entities already appear on the diagram. These new entity symbols are called ‘graphical synonyms’, and can actually be very useful. If you do create unwanted graphical synonyms, all you need to do is delete the new entity symbols, and the relationship symbol will move to the original entity symbols. This could be a real pain in the neck if you added a lot relationships at the same time.

Prevention is better than cure, so remember to hold down the <Shift> key when you drag the relationship(s) from the browser to the diagram – the relationship will be drawn between the existing entity symbols and no new graphical synonyms will be added.

One problem with dragging relationships from the browser is ‘How do I know which relationship is which?‘ Here’s the list of relationships in one of the supplied demo models:

How well do you know your model? In this model, the relationship names are short, and we have some duplicate names as well. If you want to, you can make it more difficult to create duplicate names, using the ‘unique code’ setting in the model options.  As long as you synchronise your relationship names and codes, you won’t get duplicates. In anything but the simplest model, or one you know exceptionally well, that still won’t help you know which relationship you need to drag onto your diagram. It will also force you to stop giving your relationships the same name, which is no bad thing in itself.

In this model, the two ‘Belongs to’ relationships can be referred to as “Employee Belongs to Division” and “Task Belongs to Project“. Now, you could change the relationship names to include one or both of the entity names which would certainly make the browser list easier to use:

That gives you a re-work overhead you don’t really want – if (sorry, when) you need to move a relationship end from one entity to another, you’ll have to remember to rename the relationship. By the way, don’t worry about displaying the extra-long name on diagrams, because you can choose to display one or both role names instead of the relationship name (you DO use role names don’t you?), like this:

I suggest you come up with some compromise standard for relationship names so you can make sense of the browser, but don’t put too much effort into it. I very rarely look at the list of relationships in the browser. Meaningful relationship names may be useful in reports.

Alternatively, customise PowerDesigner by adding an Event Handler to derive relationship names, such as “Division Employs Employee” or “Project Requires Task”. If you do create such an Event Handler, remember to check for duplicate names.

If I want to include missing relationships in an ERD, there are two better ways. If I want to see a list of my relationships, there’s a better way of doing that as well.

OK, let’s get back to adding missing relationships. Here’s the first easy way – select the Show Symbols command on the Symbol menu, and choose the relationships you want to include:

Notice that one the relationships is listed as ‘Hidden’. It was previously displayed on the ERD, but I decided to hide it. I’ve selected it for inclusion, and it will re-appear in the diagram in the same position and style as it appeared before (assuming the entity symbols haven’t moved, of course). Including missing relationships this way will not result in graphical synonyms being added (unless, perhaps – I haven’t tested this – they were previously attached to graphical synonyms that are still present).

Don’t worry if your Show Symbols dialogue doesn’t look like the one above. I probably tailored mine using the customisation tool , so you can replicate it quite easily.

The second easy way to add missing relationships is the “Add missing link” tool Missing Links tool  on the Diagram Toolbar. If you have nothing selected, this will add every link symbol that is missing from the diagram, which may give you a few surprises. If you want to include all relationships for, say, the entity Team, here’s what you do:

  • select the symbol for the “Team” entity
  • click on the “Add missing link” tool

PowerDesigner presents a choice for you:

Missing Links options

  • select the first options to add all missing links for the selected entity. This will include relationships and traceability links connecting the entity other symbols that er already on the diagram.

Now for my final point, listing relationships without using the browser. Which would you rather work with, the list of names in the browser, or a list that you have control over? In the list of relationships shown below (via Relationships on the Model menu), I can choose the properties I want to see, the order in which to show them, sort the listing, and filter according to property contents:

Again, this is a customised list, so it may take you a few minutes to achieve, but the results will stay with you – I carried out this customisation several months ago. I can click on the column headings to sort the list if I want to. I can also edit any of the properties that are displayed, as long as they aren’t shown in grey. By adding new rows to the list, I can create new relationships, which will automatically be added to my current diagram.

By the way, the ‘S’ column tells me whether or not the relationship has a symbol on a diagram – the first one on the list does not have a symbol.

Advertisements

6 Responses to “Adding existing relationships to a diagram in PowerDesigner”

  1. Prafl Says:

    Question: what is best practice to organize conformed dimension sharing in more than one PDM? I would like to keep PDM files separately.

    I am new to power designer so please let me know if you need more details.

    • George McGeachie Says:

      Off the top of my head there are a number of options
      – manage the conformity in a LDM, and generate/update multiple PDMs from there
      – have a PDM that contains the conformed dimensions, and replicate them in the other PDMs – by default, they can be used in those other PDMs, but can’t be amended

  2. Diane Says:

    It does not work between synonymes tables. Even if I selecte the sysnonymes tables and ask to complete de links, the relationship does not show.

    • George McGeachie Says:

      Hello Diane

      I’ve just tried this in a CDM and a PDM – selected two graphical synonyms then clicked on the ‘add missing links’ tool. The relationship and reference were added to the diagrams, though not between the two symbols I’d selected; the parent symbol was OK, but the child end of the link was connected to the original symbol, such as Customer:1.

  3. Sommer44U.Wordpress.com Says:

    Thanks for finally writing about >Adding existing
    relationships to a diagram in PowerDesigner | Metadata Matters,
    by @MetadataJunkie <Liked it!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: