Solved

TCRDBGrid summary problem

Posted on 2004-03-24
7
1,605 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

911 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now