Solved

TCRDBGrid summary problem

Posted on 2004-03-24
7
1,626 Views
Last Modified: 2010-05-18
Hi,

I have 2 CRDBGrids, one master, second details.
In the details grid I have a summary tab which shows a sum of one column.

The problem is, the sum doesn't change when I select the different record in the master grid. It always shows the sum of the first record in the grid.
I'm using ADO queries reading data from access database for these grids.

How would I fix this problem?

Thanks,
Dragan
0
Comment
Question by:cP6uH
  • 3
  • 2
7 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10669155
ARe you using a Calculated Field to show the Sum?

Shane
0
 
LVL 11

Accepted Solution

by:
shaneholmes earned 50 total points
ID: 10669197
Calculated Fields are only for display purposes only,
They are not Real (Persistent) Fields they only exist in Memory.
You CANNOT Search or Sort on Calculated Fields.
So, be aware that Calc. Fields are not real.

To use a Calculated Field, you have to do 2 things
        -Create a New field for a Table using the Fields Editor
                (Right Click on Table and select Fields Editor
        -Use the Table's OnCalcFields Event, to do the calculation and put the data in the Calc. Field
                e.g.
        n1:=T1.FieldByName('N1').AsInteger;         // N1 and N2 are Real Fields
        n2:=T1.FieldByName('N2').AsInteger;
        T1.FieldByName('CalcN3').AsInteger:=n1+n2; // CalcN3 is a Calculated Field (not real)

Shane
0
 

Author Comment

by:cP6uH
ID: 10669317
No, I'm not using calculated field.

I'm using CRDBGrid which has an option to show a sum of the column in the summary tab (dgeSummary).
The way you set it up is: set OptionEx property to ([dgeEnableSort,dgeLocalFilter,dgeSummary]).
Then edit the columns of the grid, and select the column and change the SummaryMode to smSum.

It works fine for the first record when I run the App, but when I select a different record, the sum still shows the sum for the first record in the master grid.

Dragan
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 11

Expert Comment

by:shaneholmes
ID: 10669378
Sorry, never heard of a CRDBGrid......Who makes it?

Shane
0
 

Author Comment

by:cP6uH
ID: 11382625
Admin, can you please close this question.
I have fixed this problem.

thanks
0
 
LVL 2

Expert Comment

by:Kanan
ID: 12053305
Hi.

I have almost the same problem. There is no data on summary tab at the very begining

Kanan
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Working with hours 3 65
Open a URL with Internet Explorer in a new tab (not a new window) 1 121
Delphi inherited method 6 76
Browsing a TTreeView in Delphi 5 10
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question