Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setup Relationship between Business Objects (BO)
Message
 
To
11/08/2004 12:06:18
June Kendrick
Kendrick Associates, Inc.
New York, United States
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00932054
Message ID:
00932401
Views:
15
>So, I've got a persistant relationship defined in my DBC between two tables in a one to many relationship. How does the foreign key get put in the child table?
>
You must define the tables yourself and setup the necessary columns and indexes to allow for a relationship. There is no "automatic" foreign key column generation happening here.

>I played with Codebook a bit before buying MM, and there you told the BizObj what the foreign key was, and it updated it on new. How does it work in MM?
>

I never worked with Codebook before so I can't comment on that. However, in MM you must manually set the value of the foreign key in your code. One place where this is usually done is in the presavehook of the form class that is adding a child row. For example, if you're adding an order item (child) for an order (parent) do the following in the presavehook method of the form that is adding the child:
replace orderid with v_order.orderid in v_orditem
>I had no referential integrity defined on the child table, and was getting a record with a 0 foreign key. I added RI to restrict on insert, and now I'm getting "INSERTRIGGERMSG." (How do I change the text of this?)
>

To me, this message is for developers and not for users. We put the referential integrity to add another layer of checking to be sure the database is valid. So if you get this message in production, you definitely didn't test very well. And if you get this message during testing, you know you missed assigning the foreign key or have some other insert error pertaining to the database.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform