cancel
Showing results for 
Search instead for 
Did you mean: 

Why my primary key column is not underlined?

Former Member
0 Kudos

Hi friends,

I'm very new with PowerDesigner and the data modeling and I'm playing with trial edition of PowerDesigner. I watched this video at youtube: www.youtube.com/watch?v=_YIae5mwmNU and I observed some difference between the video and my instance of PowerDesigner. (BTW, all my testing is in a Physical Data Model)

1. In the video, primary key columns have been underlined.

http://i.imgur.com/L3W1Vmp.png

And my testing is this:

http://i.imgur.com/rYu3J9m.png

Note that I've already set "id" as primary key column but it does not get underlined.

2. In the video, there is a "D" column, but as you see in the previous snapshot, my PowerDesigner doesn't have that column. What's the "D" column stand for?

http://i.imgur.com/Il8NvFw.png

3. The video author said, when we create relations between 2 entities, we need to drag from the child entity to the parent entity. The author actually drag from department entity to employee table and below is a snapshot from the video.

http://i.imgur.com/wwGl4VQ.png

But as I understand, the employee entity here should be considered as the child entity and the department entity should be parent entity. It's because each employee should have a department_id to represent which department he or she is in. Is my understand correct? Also after the author drag from department to employee, a new column "employee id" was added automatically to the department entity.

When I drag from employee to department, what I got is show in the following snapshot:

http://i.imgur.com/z1CosSe.png

As you can see, no new column has been added to the employee table and it just use the primary key column "id" as a foreign key column. That's apparently not correct. I've looked around in the software but still can't fix it.

Could anyone help me on my problems? Thank you in advance!

Accepted Solutions (1)

Accepted Solutions (1)

GeorgeMcGeachie
Active Contributor
0 Kudos

Hello Ivor

1. the display preferences for the diagram allow you to choose the font for primary key attributes; this defaults to 'underlined' as you said. So, I assume that the default font is not what you would expect. Arnaud suggest that you check the format of the symbol, instead I suggest you check the preferences for the whole diagram

- right-click the diagram background

- select Display Preferences

- select 'Table' on the left

- select the 'format' tab, and proceed as per Arnaud's instructions

- click  on OK, then apply to all symbols

2. There is a filter button that allows you to choose which columns to display - you can find instructions in PD help, just search for 'Customizing Object List Columns'. The customise and filter button is two buttons to the left of the Excel export button.

3. In the CDM and LDM, you draw relationships from parent to child entity; in the PDM you draw them from child to parent table

Former Member
0 Kudos

Thanks George!

As Arnaud suggested I've changed the two primary key columns from "id" to "employee_id" and "department_id" and I can create the relationship now. I want to know if it's possible to use my original design (both primary key columns are named "id") and to create the relationship?

Thanks.

c_baker
Employee
Employee
0 Kudos

Yes.

From the 'Model Options/Model Settings/Reference', select 'Auto-migrate columns' and de-select 'Auto-reuse' columns.

Then when you create your reference using the reference tool and dragging from child to parent, the FK will be created in the child table with a default name based on the parent table.  You can simply rename this column.


Chris

c_baker
Employee
Employee
0 Kudos

As a caveat to the above, if you leave the 'Auto-migrate' on, and in the future decide to delete the reference for any reason - e.g. to prevent the reference being generated (inconsistent data, enforcement of data loading order, etc) - the FK will be deleted as well.

To prevent this, either turn off the 'Auto-migrate' to keep the FK column, before deleting the reference, or better yet, mark the reference itself to not generate (open the reference properties sheet and uncheck 'Generate').  This will leave the reference intact in the model for better documentation.

This will not change the symbol, so you will not know which references in your model are marked to not generate.

To visually show the difference, you could change the symbol manually using the symbol format, or you can dynamically change the symbol on the diagram (e.g. colour red) by attaching or creating a model extension with a simple criterion as follows

Use 'Model/Extensions' dialog to create or attach a model extension, then edit it to add the 'Reference' metaclass and add a criterion to it:

For the Custom Symbol, change the colour to 'Red' using the 'Modify...' button:

After saving it all, have a look at your reference now.  The line colour will change dynamically as the 'Generate' flag of the reference properties is selected/de-selected and saved.

Chris

Former Member
0 Kudos

Thanks very much Chris!

Answers (1)

Answers (1)

arnaud_laurent
Employee
Employee
0 Kudos

Hello,

Right-click the table symbol on your diagram and select Format.
Click the Font tab.
Select Table PK Columns in the list of symbols.
Make sure the Underline check box is selected.

The "D" check box says whether column should be displayed in the table symbol or not.

Regarding the PK, both parent and child tables have a primary column with same name "id".
In the video, they are EMPLOYEE_ID and DEPARTMENT_ID.

HTH,
Arnaud

Former Member
0 Kudos

Thank you Arnaud for your explaination!

For my last question, what if I want to set the primary key column in all my tables as "id"? Is there a way to make it work in that case?