Subject Re: [IBO] aggregate fields? Persistant fields?
Author James
Hi Eddie,

Eddie Bush wrote:

> Assuming a "detail data-set" with a FK to the master named MasterId
> and a field named myField that is an line-item total:
> T.MasterId,
> Sum(T.myField) as TotalAmt
> TheTable T
> T.MasterId = :MastId
> T.MasterId;
> I think that's what you're looking for. This will go through the
> table "The Table" (this is the detail data-set), and sum all the
> "myField" fields having a "MasterId" field determined by the :MastId
> parameter. You could poke this into a TIB_Query and
> exec/open/activate it to retrieve the sum, or you could iterate over
> it and sum it yourself.
> Is that what you're looking for? This is a pretty basic query. If
> that's what you're looking for you might do well to find an SQL book
> and study it some - there's a lot of power in SQL.
> Notice I renamed the sum to TotalAmt (by saying 'as TotalAmt') so that
> it can more easily be referenced through the query ...
Since we're dealing with IBO here. Is there a way to get the sum in the
client side without going thru each record? IMHO is a C/S setup wherein
network traffic is sensitive that solution could be not wise. What if we
got a complex formula for getting the TotalAmt wherein there is a need
for some if then else statement and etc. Isn't putting this kind of work
is much better in the client side? I have been finding the best
solutions for this scenario also.

Greatly appreciate for your opinions guys.