Re: Refreshing current record in a form (Feature request ?)
Mike Richardson <mike-1gTsUfBLqWsG2Il/[email protected]> Mon, 12 Sep 2005 10:08:38 +0100
| Newsgroups | gmane.comp.db.rekall.devel |
|---|---|
| Message-ID | <[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.