Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RI fails when restrict is put on updates
Message
From
08/04/1998 11:53:21
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00090299
Message ID:
00090467
Views:
18
Dave -

That makes sense for the relationship (in my case) between the address table and the main people table where I will know the people_id when I create the address. But I'm also getting the same error using an append blank for my main people table, because certain fields (prefix, suffix, jobtype) are children to other lookup tables. In that case I can't use an insert into because I don't know those values yet. Or is that an inappropriate use of using the restrict on update (it seems important in that I want to, e.g. make sure they select a job type from the list)?

Sylvia

>unique key in parent table should be generated as default value when adding a parent. when adding a child to a parent record, you know what the parent's unique id is -- say insert into child_table parent_id values (m.parent_unique_id) instead of append blank.
>
>>>The problem with the restrict RI sentence is:
>>>
>>>if you have a Master Table an A child Table, and the RI is restrict on update, when you insert or append blank a record in a child table and do not insert with a FK value, the RI Fails, becouse any value in the parent table is equal to the value qhat you are atempt to insert in your child table.
>>>
>>>Example
>>>
>>>Master Table
>>>ID Description
>>>1 First Record
>>>2 second Record
>>>3 another Record
>>>
>>>if you do this:
>>>Select Child Table
>>>Append Blank
>>>**In this moment the RI verify if any recod in the Master Table is equal to he value qhat you are insert in the Child table and generate a error.
>>>
>>>You have to do this:
>>>
>>>Inser into Child Table (ID) values (thisform.combo1.value)
>>>the RI verify the value inserted and this is into the Master Table and all is OK.
>>>
>>>Sorry with my English!
>>>
>>Fernando -
>>
>>No problem with the English. If I understand you correctly, you're saying that the triggers fire as soon as you do the append blank, so at that point any child record won't have the key the master table is looking for. But I'm using table buffering with my address table, and thought I wouldn't have the error then.
>>
>>Sylvia
>>
>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform