Posted By: Hawkeye Summing Values when using CachedUpdates - 04/25/07 06:06 AM
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
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".
Posted By: ldsandon Re: Summing Values when using CachedUpdates - 04/27/07 02:47 PM
You can also use a TClientDataset getting data from the other dataset. TClientDatasets supports aggregates on their own too.
© Allround Automations forums