main logo
Subject: Re: Updates and child records...
Author: Mike Devlin
Posted: 2001/09/25 13:59:59
 
View Entire Thread
New Search


<i><font color="#663300">I have many times read on this forum the 'rule of thumb' which states, "...only one updateable table per view and only one updateable view per business object. I thought I understood this axiom until tonights musings. How does one handle an update that involves child records. For instance, if one creates a new invoice it is necessary to update both the invoice table and the invoice item table. Assuming that the data entry for the invoice and items is handled on the same form, does one place two business objects on the form?</font></i>

Hey Virgil,
Well, I guess I have asked enough questions in thos Forum to actually venture an answer to your question. I have done exactly what you have said to handle this situation. I have the invoice bizobj as the primary bizobj and the foreign key to the item table set as the keyfield. I set up a parameterized view of the items table(NoDataOnLoad = .T.). I put the controls associated with the invoice table on the form and a data entry grid to display the records of the items table. The grid's default behavior is to manipulate the data apart from the primary bizobj (not exactly recommended by the pros, but...). The Requery()of the form in the init() gets the records for the parameterized view and set up the grid.

Check out mesage 6008, 5426, 5387 for more info on this topic from the pros.
There is recent thread that has the bit of code I used to get the grid to update the table it is associated with. I just use REPLACE statements to put in the default values.
I hope this all helps. This Forum has a whole lot of threads on different topics that are a great help.

Devman
mdevlin /AT/ ajdebruin .DO.T com

 
©2001 Mike Devlin
<-- Prior Message New Search Next Message -->