Subject Re: [ib-support] calculated fields
Author Raymond Kennington
Ulrich wrote:
>
> Hello,
>
> not to calculate the amount of every bill stored in a table on every client
> again and again, I thought about to calculate the amount of every stored
> bill with a computed field. I do this with a stored procedure. I defined the
> computed field as :
>
> COMPUTED BY (((select AMOUNT from CALC_AMOUNT(BILL_ID))))
...

One way to speed things up is to keep the total up-to-date using
triggers. This adds only a little time to each individual record
change (insert, delete, update), but adds significantly to the
complexity of a program if there is more than one level deep of tables
that affect tables that affect tables, etc. This gets worse if 2
independent tables can trigger the auto-update of the total
separately. In a multi-user environment this becomes more complex.

Keeping calculated fields up-to-date for historical records can also
add another deep level of complexity when changes made later can
change the amounts in the historical records which then trigger
changes in later records. E.g. "Amount available at the time".

Users will have to wait. Usually the information is supplied only when
demanded.

Finally, if you keep calculable fields up-to-date, then there is
increased complexity in maintaining the metadata.
--
Raymond Kennington
Programming Solutions
TeamW2W (InfoPower)