Properties
FieldsList
DataSource
Totals
Events
AfterCancel
AfterDelete
BeforeDelete
OnTotalsChanged
Methods
RefreshTotals
ZeroTotals
Pricing and Contact information
TDBFieldTotaliser is a component for Delphi 3.0x, 4.0 and C++ Builder 3.0 that will provide a running total for any numeric field(s) in a dataset. The TDBFieldTotaliser component is completely dynamic. Once an edit on a field is complete then the total for that column is recalculated to reflect the new value. The component responds to all data events to ensure that the total for a monitored column is always up to date. The client application is notified of changes to any total via an event. TDBFieldTotaliser can monitor any number of fields in a dataset and will monitor any numeric type over 1 byte in size.
TDBFieldTotaliser will work in all circumstances. If the monitored dataset is involved in a master-detail relationship then TDBFieldTotaliser will re-calculate totals when the master dataset changes. The component is also aware of cached updates and will calculate values from a fields NewValue property when changes occur in the cached dataset.
TDBFieldTotaliser will install itself on to the Samples page of your component palette.
Assuming that you have already placed DataSources and DataSets on to your form or data module here's what you do:
Basically it works by digging its claws into the host dataset.
It is easy to monitor edits and inserts to records and provide an accurate running total. The TDataSet.State property allows the developer to know when edits or inserts are taking place. The TDataSet.State property does not cover conditions such as record deletions or the cancellation of a record edit or record insertion. The TDBFieldTotaliser component needs to know about all operations carried out on the contents of the monitored dataset so that all totals are accurate.
As mentioned above monitoring edits and deletes is relatively easy to do, TDBFieldTotaliser finds out about deletions and cancellations by attaching its own event handlers to the host datasets BeforeDelete, AfterDelete and AfterCancel events. If you have your own event handlers on any of the above events defined at design time then the TDBFieldTotaliser keeps a note of your event handlers and calls your event handlers before it does any of its own processing. By calling your original event handlers first, any exceptions you may raise will cause the TDBFieldTotaliser event handlers to abort and leave any totals as they are. The down side to this approach is that if you change any event handlers at runtime, by re-assigning the method pointer for instance, will cause TDBFieldTotaliser to lose its event handler connection to the monitored dataset and the totals will become inaccurate. To get around this shortcoming TDBFieldTotaliser provides it own BeforeDelete, AfterDelete and AfterCancel events. If you need to re-assign an event handler at runtime then you should do so via the event handlers provided by TDBFieldTotaliser.
This component is shareware. You may evaluate it for 30 days and then either pay for it or stop using it. Purchasing this component entitles you to the source code and free updates via e-mail. The cost of this component is £10.00 or $15.00US.
Please note that the shareware evaluation verision has a nag dialogue built into it.
Comments and bugs may be reported via e-mail to: barry@arrakis.clara.net
Payments should by Cheque, for UK
users, or International Money Order in sterling for overseas
users. To be made to:
Barry Carr
9 Haddon Grove
Sale
Cheshire
M33 7TT
United Kingdom
Please ensure that you supply your address or e-mail address so that I can get the component to you.
TDBFieldTotaliser is the copyright (c) of Barry Carr July 1998
I, BARRY CARR, MAKES NO
WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING WITHOUT
LIMITATION ANY WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE.
IN NO EVENT WILL I, BARRY CARR, BE LIABLE TO YOU OR ANY THIRD PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE OR ANY SUPPLIED DOCUMENTATION.
By using this product, you agree to this. If you do not agree, immediately return this product.