>
Maybe there is a function to show the max- value of a database field?
>
You can use sql statment to find maximum value.
example:
SELECT MAX(SALARY) FROM EMPLOYEE WHERE AGE > 30
( or some appropriate statement like that).
You will get the result much faster if the SALARY column and AGE column are indexed in the above example. We can achieve more by combining the normal familar ISAM code blended with SQL code where appropriate.
Interestingly, we can use SQL on normal DBF tables also, if we open the connection to the folder in ADO. For connecting to normal DBF tables through ADO, we can use appropriate connection string from
http://www.connectionstrings.com
-------------------------------
>
oCol:bStrData := { || str(field1 + field2 + field3) }
>
it is not any more necessary in xbrowse to covert values as character values. Use of bStrData is deprecated according to documentation in whatsnew.
oCol:bEditValue := field1 + field2 + field3.
XBrowse automatically constructs the bStrData block, using oCol:cEditPicture, if assigned. In case of ADO,DBF, etc, XBrowse constructs the picture automatically based on the column characteristics.
------------------
>
I know that TSBrowse supports footers, but I don't know about TXBrowse.
>
TXBrowse supports footers.
oCol:bFooter := { || nTotal }
It is not necessary to convert nTotal into a character value. XBrowse uses the oCol:cEditPicture to format the footer.
If during the course of the browse, if nTotal changes, we do not have to reassign the revised total. oCol:RefreshFooter will do. Or oBrw:RefreshFooters will refesh all footers without refreshing the rest of the browse.
I find the xbrowse footers are extremely convinient to use.
----------------------
About showing totals of the columns in the footers. I do ths in many cases, because users want this.
Obviously, in single user mode it is easy. But here i like to say how convinient it is to handle footers in xbrowse.
XBrowse automatically refreshes the column's footer also, after editing a value in the column, if oCol:lTotal is set to .t.
We can write in the oCol:bOnPostEdit block to change the value of nTotal after successful edit. Then without writing any extra code, XBrowse refreshes the column value and also the footer with new nTotal.
I normally maintain the footer values in an array ( keep updating them on edits ) and let the xbrowse do the appropriate refeshing job.
Now as Mr James points out, the problem is quite complex in multiuser environment. We develop our own techniques depending on the speicifics of the program module, data and environment when and how to sense other user modifications and whether to recalculate totals on the client only or to recompute totals of the table on the server. ( Now SQL does great job when needed : Exampe SELECT SUM(SALARY),SUM(COMMISSION) FROM MYTABLE WEHRE MYCONDITION ). No unique way, but what we do depends on our program and database design.
But nonetheless, our coding to refresh footers in xbrowse is the simplest.