Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TCRDBGrid summary problem

Posted on 2004-03-24
7
Medium Priority
?
1,682 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 150 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

664 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