Subject Re: [IBO] automatic refresh physical calculated fields
Author Helen Borrie
At 12:10 PM 18/03/2004 +0800, you wrote:
>Hi Helen,
>Helen Borrie wrote:
> > At 03:37 AM 18/03/2004 +0000, you wrote:
> > >Hi Helen,
> > >
> > > > No. Computed on the server means computed on the is
> > >read-only
> > > > and it can not change until the output is recalculated.
> > > >
> > >
> > >What will be the best way for that field to be display once a post is
> > >made but now yet committed? Iam using the IBExpert Personal Ed. I try
> > >inserting a record after posting it with out committing the computed
> > >field immediately show the result of the computation.
> >
> > Sorry, James, I can't understand the question.
> >
>Iam sorry, please bear with my poor english. Here is the DLL of my table.
>CREATE TABLE "birinvoicedetails" (
> "invid" INTEGER,
> "qty" INTEGER,
> "prodid" INTEGER,
> "price" NUMERIC(15,2),
> "subtotal" COMPUTED BY ("price" * "qty")
>In IBO, what happen is when I insert a record, assuming the "qty" field
>is 10 and the "price" is 55 that means that the "subtotal" field will be
>550. But after posting the record the 550 won't appear until I run this
>line "ib_transaction1.refresh(true);"

Correct. Your field is calculated on the server at output time. There is
no other way to get the new value except to pull that row across.

>My question is after posting

By "posting" do you mean "posting" or Autocommitting?

>there a way for the value in the "subtotal" field will be display right
>after posting it even if its not yet committed?

There is no native behaviour of the client interface that could do
that. If you are correct and you are seeing the "result" of a COMPUTED BY
column whilst the row is uncommitted, then my conclusion is IBExpert has a
GUI trick, whereby it creates calculated fields for any COMPUTED BY columns
and displays the calculated fields instead of the computed columns. It
calls the equivalent of CalcFields in response to OnChange events in the
GUI. You could manage it this way if you wanted to....