FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse:MakeTotals()
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM

xBrowse:MakeTotals()

Posted: Fri Jan 13, 2012 11:53 AM

Hello,

When doing an xBrowse refresh() or update(), why maketotals are not updated?.

Thanks.

FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 401
Joined: Thu Oct 06, 2005 10:15 PM

Re: xBrowse:MakeTotals()

Posted: Fri Jan 13, 2012 12:13 PM
Code (fw): Select all Collapse
 oBrw:MakeTotal()
 oBrw:Refresh()
Saludos,



Pablo Alberto Vidal

/*

------------------------------------------------------

Harbour 3.2.0, Fivewin 17.02, BCC7

------------------------------------------------------

*/
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM

Re: xBrowse:MakeTotals()

Posted: Fri Jan 13, 2012 12:23 PM

Yes, in order to fix it I call oBrowse:MakeTotals()

But why it is not done automatically?.

Thanks.

FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: xBrowse:MakeTotals()

Posted: Fri Jan 13, 2012 12:50 PM

To not slow down the refresh method, I suppose.

EMG

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: xBrowse:MakeTotals()

Posted: Mon Jan 16, 2012 08:50 PM

Mr EMG is right.

MakeTotals() is a handy method to avoid complex coding but is not optimized for speed. Instead this method is coded to provide highest degree of flexibility.

While this is suitable for tables in memory ( arrays, recordsets ) and small and medium tables, it is not suitable for large tables and in particular tables on networks.

In such cases the programmer has to adopt his own ways to optimize recomputation of aggregates in the footers.

Also, once MakeTotals() is called in the beginning, it is not necessary to call this method for every refresh. Any inline editing of the values in the table automatically update the aggregates ( without retotalling ) and refresh the footer. Normally there should be no need to call the method again.

If the programmer intends to substitute the value of a column, he may use oCol:VarPut( nNewValue ). This will suitably adjust the aggregate and refresh the footer.

Exceptions: Add a row, delete a row or re-read the entire data.
While adding or deleting a row, the programmer may choose between updating the totals programatically or by calling maketotals() method again, considering the performance issues.

All said and done, by experience we find MakeTotals() is still very useful and we never notice any performance sluggishness in a majority of cases. Best use of this method is while handling complex aggregates like STDEV, etc which otherwise require lots of coding.

So, whether to use the method MakeTotals() or not either in the beginning or while refreshing is left to the best judgment of the programmer.

Regards



G. N. Rao.

Hyderabad, India
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM

Re: xBrowse:MakeTotals()

Posted: Mon Jan 16, 2012 08:56 PM

Thanks a lot.

it is working fine as it is not a big table.

xBrowse is so much powerful ;)

FWH 11.11, Harbour 3.1 and Borland C++ 5.82

Continue the discussion