On Sunday 23 December 2007 5:21 pm, Ed Leafe wrote: > On Dec 23, 2007, at 7:51 PM, Adrian Klaver wrote: > >> Yes. When you changed the table in the backend, the data in the > >> bizobj is now out-of-date. You would have to call requery() to get > >> the latest values in the database. > > > > Then maybe you can clear up something for me. In the api docs the > > dForm.update > > method has the following description: > > > > update(self, interval=None) > > > > Updates the contained controls with current values from the source. > > > > <snip> > > > > I assumed the source was the table to which the bizobj refers. > > Therefore I > > thought when I did self.update() it would go back to the table for the > > values. Am I to understand that the source is the cursor/DataSet > > and that in > > order to get fresh values in a form control I have to call requery > > () in order > > to refresh the data in the cursor/DataSet and hence the form? > > The source is the bizobj; i.e., the 'DataSource'. The update() > method is called frequently; it would not be wise to have it > constantly requerying the database.
I sort of understand. Let me see if I can work this out. In my case the bizobj refers to a table (which from the documentation is the 'default' use) so I saw the table as the DataSource, not the bizobj. What you are saying is that the bizobj as the middleware component caches data in its structure and update() works on that structure and requery() works on the underlying table. Am I getting close? > > There's another good reason not to behave that way: let's say you > run a query and get back 10 records. You change the name in the first > record from 'Smith' to 'Jones'; now the bizobj has 'Jones' for the > name, but the database has 'Smith', since you haven't saved your > changes yet. Then you call next() to move to the next record; update > () is called to refresh the controls with Record #2's values, so now > the name field shows 'Baker', which is the name of record 2. After a > while you call prior() to go back to the first record (the one that > you modified); update() is again called to change the controls to > display the values for Record #1. But what should be displayed in the > name field? The original value in the database, or the modified value > in the bizobj? If my assumptions above are correct I can see how this would be a problem. To play the Devils advocate I prefer that data is automatically saved when moving from record to record. I have greater faith in a database table holding data than an application. My inclination is to make the data hit the database soon and often. From poking around I can see ways to make that happen, I just have to work out the procedure. > > I think that if anything but the modified value in the bizobj were > to show, there would be a lot of angry users whose changes were being > erased by Dabo. > > -- Ed Leafe > -- http://leafe.com > -- http://dabodev.com > > > > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]
