Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » Parent-Child table relationships
Parent-Child table relationships [message #970] Mon, 23 July 2007 12:02 Go to next message
adamsp is currently offline  adamsp
Messages: 32
Registered: July 2007
Member
I have several tables with Parent-Child structure. Some allow a single record for the Parent-Child combination.

Tables: FAMILY, PERSON, FAMILY_PERSON

Desired outcome:
Each FAMILY_PERSON record must
refer to an existing record in FAMILY
refer to an existing record in PERSON
each FAMILY+PERSON combination can exist only once.

My implementation uses 3 keys:
foreign key to FAMILY from FAMILY_PERSON
foreign key to PERSON from FAMILY_PERSON
primary key in FAMILY_PERSON on FAMILY+PERSON

In Radicore, from the FAMILY_PERSON table, when I go to add a relationship to setup the foreign-key to FAMILY (or PERSON)...after I click "submit" and then get to "update" (relationship), I always presented with BOTH family and person...to set the references to both...presumably because this is the primary key. But I only want to enter the family (i.e. to validate that the family record exists in the FAMILY table).

Am I doing this correctly? How can I set this up these table relationships in Radicore?
Re: Parent-Child table relationships [message #971 is a reply to message #970] Mon, 23 July 2007 15:57 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
In order to define a one-to-many relationship in the Data Dictionary you must always start from the "one" (parent) table before selecting the "many" (child).

Re: Parent-Child table relationships [message #972 is a reply to message #971] Tue, 24 July 2007 06:58 Go to previous messageGo to next message
adamsp is currently offline  adamsp
Messages: 32
Registered: July 2007
Member
Thanks. If I understand correctly, it is a bit counterintuitive. In the relational database we define the foreign key in the SECONDARY table that points to a primary or unique key in a PRIMARY table. However, in Radicore, we setup the relationship in the PRIMARY table pointing to the column(s) in the SECONDARY table. Is this correct? (It appears to work this way).
Re: Parent-Child table relationships [message #973 is a reply to message #972] Tue, 24 July 2007 07:35 Go to previous message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
In all the data modeling tools that I have used it has always been the practice to define one-to-many relationships starting from the "one" entity. The primary key field(s) of the "one" entity are then pre-selected, which you then have to link manually to the corresponding foreign key fields in the chosen "many" entity.

Radicore does not use foreign key constraints, therefore it cannot identify foreign key fields automatically.


Previous Topic: Accessing Radicore for the first time
Next Topic: Accessing my Radicore App for the first time
Goto Forum:
  


Current Time: Fri Nov 08 22:42:19 EST 2024

Total time taken to generate the page: 0.01091 seconds