Print Thread
Summing Values when using CachedUpdates
#9214 04/25/07 06:06 AM
Joined: Apr 2004
Posts: 8
San Antonio, TX
H
Hawkeye Offline OP
Member
OP Offline
Member
H
Joined: Apr 2004
Posts: 8
San Antonio, TX
Environment
Delphi 7
DOA 4.0.7
Woll2Woll Infopower 4000

We have a situation where I need to be able to sum dollar amounts in a Detail data set prior to Applying updates. We have two datasets in a Master-Detail relationship with CachedUpdates set to TRUE. On the Save button click of the form (Delphi 7) we do a MasterDataSet.ApplyUpdates which is posting and commiting the data. Prior to this happening I need to be able to retrieved the summed value of the dollar column in the Detail Dataset to display in the footer of the grid (Woll2Woll InfoPower 400 wwDBGrid component, the OnUpdateFooter event). When I execute a TOracleQuery against the Detail table I do not get any of the records added prior to the ApplyUpdates (which actually makes sense since Oracle doesn't know about them yet). Is there any way for me to sum the dollar column values in the Detail dataset. I would prefer to clone/copy the Detail dataset so it is not connected to the Grid while the summing takes place.

Thanks
Richard Anderson

Re: Summing Values when using CachedUpdates
#9215 04/25/07 10:05 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
Member
Joined: Aug 1999
Posts: 22,208
Perhaps you can simply use DetailDataSet.DisableControls/EnableControls and calculate the sum by navigating the detail dataset? This is equivalent to being "not connected to the Grid while the summing takes place".


Marco Kalter
Allround Automations
Re: Summing Values when using CachedUpdates
#9216 04/27/07 02:47 PM
Joined: Jul 2003
Posts: 112
Fino Mornasco, Como, Italy
L
Member
Offline
Member
L
Joined: Jul 2003
Posts: 112
Fino Mornasco, Como, Italy
You can also use a TClientDataset getting data from the other dataset. TClientDatasets supports aggregates on their own too.


LDS

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.101s Queries: 14 (0.052s) Memory: 2.5013 MB (Peak: 3.0380 MB) Data Comp: Off Server Time: 2024-05-05 21:35:08 UTC
Valid HTML 5 and Valid CSS