i have this table struct:

id string

name string

gross real

net real

tax real

now i want to add a field like calculated field to have sum(...) of

each real type fields. is it available in a table component or i have

to make a function manually?

On 26 Feb 2006 00:21:23 -0800, "shotokan99" < XXXX@XXXXX.COM >

You can add a field object to a TDataSet. Then define the new field as

Calculated as the sum of one of the underlying table fields. The sum

then appears in the dataset. Be careful to keep in mind that a sum

field in a multi-row dataset doesn't make much sense. Check out the

SQL SUM and COUNT functions, for example. They make sense only if the

query returns a single row (or a GROUP of different sums). This means

getting a list of values and a sum of them to appear at the bottom

means either two queries or do the summation in code.

Check out these topics in localsql.hlp.

BTW, using reals for currency calculations can cause problems due to

rounding errors. Look at using currency or integers. I'm not familiar

with all the problems and solutions, but I'm sure someone here has the

guidelines for you. Just ask.

hth,

Dan

You can add a field object to a TDataSet. Then define the new field as

Calculated as the sum of one of the underlying table fields. The sum

then appears in the dataset. Be careful to keep in mind that a sum

field in a multi-row dataset doesn't make much sense. Check out the

SQL SUM and COUNT functions, for example. They make sense only if the

query returns a single row (or a GROUP of different sums). This means

getting a list of values and a sum of them to appear at the bottom

means either two queries or do the summation in code.

Check out these topics in localsql.hlp.

BTW, using reals for currency calculations can cause problems due to

rounding errors. Look at using currency or integers. I'm not familiar

with all the problems and solutions, but I'm sure someone here has the

guidelines for you. Just ask.

hth,

Dan

1. Summary fields or Summary table?

2. Adding a second summary field/page?/Merging summary report

3. Copy all data from a:Class A's fields to the namesake fields of b:Class B.

4. Add new field in table that is the sum of fields in the same table

5. add a field from one table to a field in another table

6. Add a field to a report after adding field to table?

7. Get(summary) VS Summary field

8. Sub-summary report - problem working out which summary field to use

9. Multiple summary fields in a sub-summary?

10. Get(summary) VS Summary field

11. Pivot Tables - Showing Details for some fields, but just summaries for others

12. Summary fields, calcs and related tables

13. summary field in related table

14. Batch add custome Summary/Doc Properies field?

15. Summary field "work" adds duration time to total task

2 post • Page:**1** of **1**