Book a Demo

Author Topic: Table parent-child  (Read 3147 times)

kgish

  • EA User
  • **
  • Posts: 62
  • Karma: +0/-0
    • View Profile
Table parent-child
« on: May 14, 2005, 11:33:51 am »
I have a table with the following fields:

ID - (PK) not null
ParentID - (FK)
Description -  not null

How can I use an association to represent a link between the ID and ParentID fields within the same table?

Bruno.Cossi

  • EA User
  • **
  • Posts: 803
  • Karma: +0/-0
    • View Profile
Re: Table parent-child
« Reply #1 on: May 14, 2005, 11:59:48 am »
Hi,

simply create the table and columns, mane sure you mark "ID" as a primary key. Then create an association from the table to itself, go to the association's properties and in the source role tab specify ParentID as the role, in the target role tab select your primary key (not the column, the primary key itself) as the role.

Hope this helps!
Bruno

Quote
I have a table with the following fields:

ID - (PK) not null
ParentID - (FK)
Description -  not null

How can I use an association to represent a link between the ID and ParentID fields within the same table?


kgish

  • EA User
  • **
  • Posts: 62
  • Karma: +0/-0
    • View Profile
Re: Table parent-child
« Reply #2 on: May 14, 2005, 12:11:19 pm »
Hey, that works like a piece of cake, thanks. It never struck me that I could drag the association from and to the same table.

Bruno.Cossi

  • EA User
  • **
  • Posts: 803
  • Karma: +0/-0
    • View Profile
Re: Table parent-child
« Reply #3 on: May 14, 2005, 12:29:04 pm »
No problem :-) A good way of figuring these things out is to create the table in the database and reverse-engineering it into EA.

Bruno