Subject Re: [firebird-support] Field computed by
Author Helen Borrie
At 11:13 AM 30/06/2005 -0300, you wrote:
>First of all sorry for my bad english.
>
>I'm having some problem while using computed by fields. I have 1 table
>named SALES with fields like: product_ID, quantity, unit_price, and a
>computed field total.
>
>I'm using IB_Query from IBO, and, when I'm inserting data
>(qrSales.Insert) the total field doesn't show its value. Only after
>qrSales.Post.
>
>Is that correct?

Yes. The computed field is calculated at SELECT. An unposted Insert
statement simply does not exist in the database yet.

>Is there any way I can show the total before
>qrSales.Post? I'd like to show the total, right after quantity and
>unit_price receive any value.
>
>Is that possible?

No. The client side has no way to know ahead what will be the outcome of a
post. However, you can add a calculated field to the dataset on the
client side, write an OnCalculateFields event handler and call
CalculateFields to respond when values in the operand fields change. For
details of how to do this, ask on the IBO list.

./heLen