Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
Quality Central
Delphi-BCB
Midas
Install
Java Midas
Socket Server
TClientDataSet
TDataSetProvider
TDCOMConnection
TMidasConnection
TOLEEnterpriseConnection
TProvider
TRemoteServer
TSimpleObjectBroker
TSocketConnection
TWebConnection
WebMidas
XML Midas
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/Midas/TClientDataSet
[ Add a report in this area ]
Report #:
1712
Status:
Closed
TFieldAggregate returns incorrect value
Project:
Delphi
Build #:
6.240
Version:
6.0
Submitted By:
Dave Rowntree
Report Type:
Minor failure / Design problem
Date Reported:
7/3/2002 4:09:47 AM
Severity:
Serious / Highly visible problem
Last Updated:
12/15/2006 4:02:56 AM
Platform:
95, 98, 2000, NT, XP
Internal Tracking #:
140326
Resolution:
Fixed
(Resolution Comments)
Resolved in Build:
:
7.0.8.1
Duplicate of:
None
Voting and Rating
Overall Rating:
(7 Total Ratings)
3.86 out of 5
Total Votes:
None
Description
A TFieldAggregate returns an incorrect value if you set a CDS filter, then unset the filter. The value then returned by the TAggregateField.Value is the sum of the CDS filtered value and the CDS unfiltered value.
Steps to Reproduce:
Run the attached program and follow the on-screen instructions.
Workarounds
Add the following procedure to your app. Whenever there is a change to a CDS filter, or a change to an index when a filter is/has been used, call the procedure, passing the CDS to it.
type
TCrackCDS = class(TCustomClientDataSet);
procedure ResetAggFieldsAndAggs(CDS:TClientDataSet);
var
i: integer;
Agg: TAggregate;
begin
// do the AggFields ...
for i := 0 to CDS.AggFields.Count - 1 do
begin
Agg := (CDS.AggFields[i] as TAggregateField).Handle;
if (Agg <> nil) and Agg.Active then
begin
Agg.Active := False;
Agg.Active := True;
end;
end;
// do the Aggs ...
for i := 0 to CDS.Aggregates.Count - 1 do
begin
Agg := CDS.Aggregates[i];
if Agg.Active then
begin
Agg.Active := False;
Agg.Active := True;
end;
end;
TCrackCDS(CDS).DataEvent(deRecordChange, 0);
end;
---------
This is Dave's workaround:
Add the following procedure to your app. Whenever there is a change to a CDS filter, or a change to an index when a filter is/has been used, call the procedure, passing the CDS to it.
procedure ResetAggFieldsAndAggs(CDS:TClientDataSet);
var
i: integer;
Agg: TAggregate;
begin
// do the AggFields ...
for i := 0 to CDS.AggFields.Count - 1 do
begin
Agg := (CDS.AggFields[i] as TAggregateField).Handle;
if (Agg <> nil) and Agg.Active then
begin
Agg.Active := False;
Agg.Active := True;
end;
end;
// do the Aggs ...
for i := 0 to CDS.Aggregates.Count - 1 do
begin
Agg := CDS.Aggregates[i];
if Agg.Active then
begin
Agg.Active := False;
Agg.Active := True;
end;
end;
end;
Attachment
FieldAggregateFilterbug.zip
Comments
Dave Rowntree at 5/11/2004 2:39:11 AM
-
Fixed in Midas.dll
Joao Toledo at 7/1/2004 1:45:39 PM
-
The problem persists with DBExpress!
I tried the attached project with MIDAS.DLL 7.1.1523 and your patch, and it worked well. But when I tried it with connection via DBExpress, the problem still is there.
Dave Rowntree at 7/21/2004 3:36:39 AM
-
The problem was fixed in the the D7.1 update, Midas.dll version 7.1.1692.666.
The Midas.dll version you are using does not contain the fix. You can obtain the updated Midas.dll version from www.distribucon.com.
You do not need to use the workaround as well as the fixed Midas.dll version, just use the updated Midas.dll.
Joao Toledo at 7/21/2004 5:50:10 AM
-
Thank you very much!
View Your Reports
Search
Server Response from: CODE1
Developer Tools
Blackfish SQL
C++Builder
Delphi
Delphi for PHP
Delphi Prism
InterBase
JBuilder
J Optimizer
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Chats
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us