Re: Refreshing current record in a form (Feature request ?)
Mike Richardson <mike-1gTsUfBLqWsG2Il/[email protected]> Tue, 20 Sep 2005 10:47:50 +0100
| Newsgroups | gmane.comp.db.rekall.devel |
|---|---|
| Message-ID | <[email protected]> |
On Monday 12 September 2005 17:40, Ernesto Revilla wrote: > Good evening, > > Putting these fields into a separate subblock could do it, although I think > it's not a very nice solution, because it's making the design more > complicate. > > I would prefer to implement a refresh option which could be called from > Python. (MS-Access has this.) Do I have a way the mark a record as "dirty", > i.e. modified, from Python? Do I have a way to force a "save record" > operation? This is because, the save record operation, does automatically > re-read the record from the database. So all the infrastructure is present. So if i've got this right, what you basically need is a "reloadRecord" operation > Perhaps I would just need a python binding. (In this case, could you give > me some tips (filenames) where to look for it?) I would try to send a > patch. Tricky, there isn't a simple binding to do that, but I can add it pretty quickly. Which version are you using? > > Best regards, Erny > > 2005/9/12, Mike Richardson <mike-1gTsUfBLqWsG2Il/[email protected]>: > > On Tuesday 30 August 2005 15:40, Ernesto Revilla wrote: > > > Hello. > > > > > > I have the typical parent-child form for invoices (or orders) > > > > introducing > > > > > article lines with quantity, price and total amount. At the bottom of > > > > the > > > > > form a box should display the total amount of the invoice. This is > > > calculated using a trigger inside the postgresql database. > > > > > > There is no refresh operation I can call from python, in the post-sync > > > event. I think that a requery operation won't do it, because it > > > > re-executes > > > > > the query for the main form, will reset the focus, eventually jump to > > > another record and do a lot of extra work that I don't need. I just > > > want > > > > to > > > > > re-read the data for the current record of the main form. (excactly the > > > operation that is done after record insertion or update). > > > > > > How could this be accomplished ? > > > > My first thought would be, can you separate the total amount field out > > into > > another subblock with its own query, such that is shows the right value, > > and > > reload just that block when needed? > > > > The last resort, though, would be to do the right SQL query "by hand", > > something like: > > > > def eventFunc (thing, ....) : > > > > import RekallPYDBI > > c = RekallPYDBI.connect (thing, '').cursor() > > c.execute ('select .......') > > d = c.fetchone() > > thing.getNamedCtrl('path/to/control').setValue(row, d[0]) > > > > The total amoutn field would be named but not have an expression > > > > -- > > Regards > > Mike > > > > http://www.rekallrevealed.org > > *THE* GPL/Open Source database front end for Linux and Windows. -- Regards Mike http://www.rekallrevealed.org *THE* GPL/Open Source database front end for Linux and Windows.