Solved

# sum up some tablefields and build chart

Posted on 2000-02-16
136 Views
hi, im a learner of delphi at the moment and wrote a small application. in this app. i have a table with numeric values. what im trying to do now is sum up a few of this values and automatically build a chart with these sums and then store the chart under a certain name. i tried several queries with sum but none worked. i hope u can help me find a solution, thx
0
Question by:ugross
• 2
• 2

LVL 12

Expert Comment

ID: 2530100
You can sum a field in a table like this:

select sum(Afield) as FieldSum from ATable where ATable.AnotherField = 42

Cheers,

Raymond.
0

Author Comment

ID: 2530110
hi, sounds pretty simple and ok will try it, do u have any idea how to put these value straight into a chart. cheers

0

LVL 12

Accepted Solution

rwilson032697 earned 100 total points
ID: 2530124
You can so this using a TChart (in the additional tab).

Add one of these to a form, create an appropriate series and use code somethting like this to fill it in:

(This is a snip from my Mortgage Planning app where it creates a chart of interest and principal payments over time)

for I := 0 to CurrentScenario.Payments.Count - 1 do
begin
TotalScenarioInterest := TotalScenarioInterest + CurrentScenario.payments[i].InterestPortion;

CurrentScenario.Payments[i].PrincipalRemaining, '', clTeeColor);
TotalScenarioInterest, '', clTeeColor);
end;

Cheers,

Raymond.
0

Author Comment

ID: 2530135
thanks for this profund answers rymond, will try them, thou i think there must be something more simple. cheers and thx
0

## Featured Post

### Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…