Solved

TCRDBGrid summary problem

Posted on 2004-03-24
7
1,592 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

10 Experts available now in Live!

Get 1:1 Help Now