FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour SUM totals of a recordset
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
SUM totals of a recordset
Posted: Tue Jan 19, 2016 07:27 PM

Hi,

Is it posible to sum the total of field in a recordset?
Now If I wanted the sum I run a query with sum(myfield) as total and it work.

But now I want to show a recordset, and the the client can put a filter on it , and then I want to sum the totals of the filter records.

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: SUM totals of a recordset
Posted: Wed Jan 20, 2016 01:02 AM
But now I want to show a recordset, and the the client can put a filter on it , and then I want to sum the totals of the filter records.

We need to calculate the sum manually.
If you are using xbrowse, oBrw:MakeTotals() does this work for us.
This is what I do too
Regards



G. N. Rao.

Hyderabad, India
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: SUM totals of a recordset
Posted: Wed Jan 20, 2016 07:46 AM

So, I do do have to make a loop in the filtered recordset, and sum() the fields?

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: SUM totals of a recordset
Posted: Wed Jan 20, 2016 07:50 AM

Yes, but instead of your doing it, xbrowse does it by itself.
Are you not using xbrowse's maketotals facility?

Regards



G. N. Rao.

Hyderabad, India
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: SUM totals of a recordset
Posted: Wed Jan 20, 2016 08:06 AM

No, I do it manualy, because it's a sum of a calculation of 2 fields....

Thanks

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite

Continue the discussion