Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

sum up of some fields of a table and store...

Posted on 2000-02-28
15
Medium Priority
?
170 Views
Last Modified: 2010-04-04
hi,
i want to sum up some fields in a table for example with query2.sql.add('select sum(1) from zwischentab');, unfort. it doesnt work (with this code, m sure its wrongand i dont know why), what im trying in addition to store this sum in a specific field in another table. hope somebody has a good solution, thx
0
Comment
Question by:ugross
  • 8
  • 7
15 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 300 total points
ID: 2567804
hi ugross,

what about this?

query2.close;
query2.clear;
query2.SQL.Add(Select Sum('+Table1.Fields[1].FieldName+') as Summe from tableName');
query2.Open;
tablex.FieldByName('NameOdTheSumField').Value := query2.FieldByName('Summe').Value;
query2.close;

explain a bit more what you want to do

meikl
0
 

Author Comment

by:ugross
ID: 2567817
looks good,thx. what im trying to set up is that in the following code the sumvalue in the tablex as u coded it will be taken to paint (canvas-like) points on a form and then show a chart.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2567829
hi ugross,

well, then try it and ask again in this q more specific if something not work as you want.

meikl
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:ugross
ID: 2576050
hi again, i tried it but i got an error telling unrecog. expression (as Summe), then tried to change some minor things to find the error, but no joy, i think there could be some basic things in my app. which r not that correct as they should be
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2576325
hi ugross,

seems that your database-system cannot aliasing fields.
try this change

query2.close;
query2.clear;
query2.SQL.Add(Select Sum('+Table1.Fields[1].FieldName+') from tableName');
query2.Open;
tablex.FieldByName('NameOdTheSumField').Value := query2.Fields[0].Value;
query2.close;

let me know if the error allways appears again

meikl
0
 

Author Comment

by:ugross
ID: 2576362
thx for the info, will try, and will inform u.
0
 

Author Comment

by:ugross
ID: 2599383
hi again, have tried this all, but no joy im getting an errormsg during runtime, in german it means "merkmal nicht verfuegbar" dont know what it means, in english it means "property not available" i think, any idea
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2599540
bad,

tell me what database you use,
and how you connect to it (odbc,native, third party)
will try to reproduce

btw. are you from germany?

meikl
0
 

Author Comment

by:ugross
ID: 2599559
yes im from germany,
im using the build in components of delphi 3 c/s means im using here 2 table components and a query to make this happen
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2599585
ja, schon wieder ein deutscher :-))

mit database meinte ich, welche datenbank benutzt du -> access, paradox, mssql, etc.
und wie du die verbindung zur datenbank aufbaust -> odbc-treiber, native bde treiber, bde replacment treiber, etc.

meikl
0
 

Author Comment

by:ugross
ID: 2599593
sorry hatte ich vergesse, benutze die bde zur admin., paradoxtabellen, eigentlich nur das was delphi selbst mittels treiber (ueber die bde) zur verfuegung stellt.danke
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2599659
ok,
sollte überhaupt kein problem sein.
habe noch d3 daheim.
wenn du deine eMail adresse hier hinterläßt, dann kann ich dir morgen oder übermorgen eine kleine Beispielanwendung schicken, die du dann mit deiner app vergleichen kannst.
(nur wenn du willst)

meikl
0
 

Author Comment

by:ugross
ID: 2599718
vielen dank mach ich gerne, meine e-mail ist ugross@bloomberg.net (begrenzt auf 2mb atachments), schau ich mir dann gleich an, ich nehme an es haengt an einer winzigkeit. danke
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2599758
yup,
denke ich auch das es nur ne kleinigkeit ist und 2 MB brauch ich keinesfalls.

ich schicks dir sobald ich fertig bin, nur heute klappts noch nicht, da ich erst spät heimkommen werde. wird also schon frühestens morgen abend, wahrscheinlich aber samstag im laufe des tages.

bis dann

meikl
0
 

Author Comment

by:ugross
ID: 2599765
wenns am wochenende ist dann schicks doch bitte an die e-mail grossu@t-online.de die ist zuhause dann hab ichs gleich in der ide, super, vielen dank
0

Featured Post

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!

Question has a verified solution.

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Loops Section Overview
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

879 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