Subject | Re: [IBO] Calculated field column total? |
---|---|
Author | Paul Hope |
Post date | 2002-02-28T22:28:30Z |
Jason
to open or refresh. I presume this is all records for FetchAll or a buffer
full if not.
So
Open;
DoSomething;
is the same as
Open;
procedure .AfterOpen();
begin
DoSomething;
end;
where DoSomething might typically be
while not eof do
begin
..
end;
I know DoSomething could be called in code at the appropriate places but
sometimes when the refresh is triggered by other events such as master
scrolling, or it is called from lots of places it would be neater to work
from event.
Just my simple thoughts :-)
Regards
Paul
> AfterOpen corresponds with the cursor being opened, not necessarily theI suppose I mean whatever the state is at the next line of code after a call
> first record being fetched, or do you mean all records being fetched?
>
to open or refresh. I presume this is all records for FetchAll or a buffer
full if not.
So
Open;
DoSomething;
is the same as
Open;
procedure .AfterOpen();
begin
DoSomething;
end;
where DoSomething might typically be
while not eof do
begin
..
end;
I know DoSomething could be called in code at the appropriate places but
sometimes when the refresh is triggered by other events such as master
scrolling, or it is called from lots of places it would be neater to work
from event.
Just my simple thoughts :-)
Regards
Paul
>other
>
> ----- Original Message -----
> From: "Paul Hope" <paulhope@...>
> Newsgroups: egroups.ibobjects
> To: <IBObjects@yahoogroups.com>
> Sent: Thursday, February 28, 2002 3:34 AM
> Subject: Re: [IBO] Calculated field column total?
>
>
> >
> > Jason
> >
> > > Yes, have two calculated fields. One for storage purposes and the
> tonot
> > > hold your real value.
> > >
> >
> > I felt a bit silly after posting the original message because I realised
> > that calculated field values are not persistent, they are not stored in
> the
> > buffer and are only calculated on request (I think). It is therefore
> > possible to access the previous value of a calculated field andtherefore
> > determine the amount of change. Also if a row is deleted (by a masterIt
> > dataset and a refresh) there is no event to allow the row value to be
> > removed from the total.
> >
> > I think the only option is to sum the whole buffer after each refresh.
> > would be neater if there was an event to hang the calculation on ratherit' -
> than
> > having to call it in code after any refresh or open call.
> >
> > This is one of the differences I found between IBO and the BDE. In the
> BDE
> > AfterOpen meant 'after the data is retrieved and you can now process
> Ithe
> > don't think IBO works the same way (unless some flags cause it to) and
> > only way to get equivalent functionality is to code the after open stuffprevious
> > after the call to Open/refresh etc. I would have thought an
> > AfterGettingTheData event would be very useful (please tell me if it
> already
> > exists and I've missed it :-))
> >
> > Regards
> > Paul
> >
> >
> >
> >
> >
> > > Jason Wharton
> > > CPS - Mesa AZ
> > > http://www.ibobjects.com
> > >
> > >
> > > ----- Original Message -----
> > > From: "Paul Hope" <paulhope@...>
> > > Newsgroups: egroups.ibobjects
> > > To: <IBObjects@yahoogroups.com>
> > > Sent: Wednesday, February 27, 2002 4:45 AM
> > > Subject: [IBO] Calculated field column total?
> > >
> > >
> > > > Hi
> > > >
> > > > I want to display a total of a calculated field for a read only
> dataset
> > > > displayed in a grid. I could fire off another query on the server
> > asking
> > > it
> > > > to recalculate a total every time a row changes in the displayed
> > dataset -
> > > > but this seems very inefficient.
> > > >
> > > > What I was hoping to do is in CalculateField
> > > > subtract ARow.ByName('MyCalculatedField').asCurrency from my total
> > > > calculate the new value of MyCalculatedField
> > > > add the new value to my total
> > > >
> > > > Unfortunately reading the calculated field value before it is set
> > doesn't
> > > > work. It seems to return the value it had calculated for the
> > > row.___________________________________________________________________________
> > > >
> > > > I have also tried summing the field values in the buffer (having set
> > > > Fetchall to true) but I havn't found an appropriate event to attach
> this
> > > > to - 'AfterRefresh' would be nice.
> > > >
> > > > Any Ideas?
> > > >
> > > > Regards
> > > > Paul
>
>
>
>
>
> IB Objects - direct, complete, custom connectivity to Firebird orInterBase
> without the need for BDE, ODBC or any other layer.___________________________________________________________________________
>
> http://www.ibobjects.com - your IBO community resource for Tech Infopapers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>