I'm trying this code:
- Code: Select all Expand view
- #include "fivewin.ch"
#include "xbrowse.ch"
#include "hbcompat.ch"
function Main()
local nAvgAge, aData, cSql
local cFolder := "c:\fwh\samples\"
TEXT INTO cSql
SELECT A.STATE AS CODE,S.NAME AS STATENAME,A.NUM,A.AVGAGE,A.SALARY FROM
( SELECT STATE, COUNT(*) AS NUM, AVG(AGE) AS AVGAGE, SUM(SALARY) AS SALARY
FROM CUSTOMER GROUP BY STATE ) A
LEFT OUTER JOIN STATES S ON A.STATE = S.CODE
ENDTEXT
aData := FW_DbfSqlQuery( cFolder, cSql )
nAvgAge := FW_DbfSqlQuery( cFolder, "SELECT AVG(AGE) FROM CUSTOMER" )
// nAvgAge := nAvgAge[1,1] // for FWH13.06 and earlier
XBROWSER aData TITLE "Statewise Employees" ;
SETUP ( oBrw:cHeaders := { "Code", "StateName", "NumEmp", "AvgAge", "TotalSalary" }, ;
oBrw:cEditPictures := { nil, nil, "999", "99.99", "99,999,999" }, ;
oBrw:lFooter := .t., ;
oBrw:NumEmp:nFooterType := oBrw:TotalSalary:nFooterType := AGGR_SUM, ;
oBrw:AvgAge:bFooter := { || nAvgAge }, ;
oBrw:Code:cFooter := cValToChar( Len( aData ) ), ;
oBrw:MakeTotals() )
return nil
but does not works.
I checked inside dbffunc2.prg (FW_DbfSqlQuery Function) and at this row crashed
- Code: Select all Expand view
...
oCn := FW_OpenAdoConnection( cFolder)
...
any suggestion ?
Thank you.