Hi All,
It's been helpful Mr. Rao providing great help on oRS Tree issues (not only that of-course)
can anyone help creating this Tree using oRS-Parent-Child? where in the child sync when tree item expanded...
function TestTree2()
local oCn
local cSql, oRs, oDlg, oFont, oBrw
oCn := FW_DemoDB()
TEXT INTO cSql
SELECT S.name AS StateName, C.city AS City, C.first AS Customer
FROM states S
LEFT JOIN customer C ON S.code = C.state
ORDER BY StateName, City, Customer
ENDTEXT
oRs := oCn:RowSet( cSql )
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 300,400 PIXEL TRUEPIXEL FONT oFont
@ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE oRs ;
COLUMNS "TRIM( StateName ) AS StateName", ;
"TRIM( City ) AS City", ;
"TRIM( Customer ) AS Customer" ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT oBrw:SetTree( 3, { 0x30082, 0x30084, 0x20097 } )
RELEASE FONT oFont
oCn:Close()
return nil
shri_fwh wrote:Dear Rao Sir,
I need to show subtotal in XBROWSE on the Tree Level. Could you please help me for the same.
Thanks
Shridhar
function TestTree2()
local oCn
local cSql, oRs, oDlg, oFont, oBrw, aSum
FWNumFormat( "I", .t. )
oCn := FW_DemoDB()
oCn:lShowErrors := .t.
TEXT INTO cSql
SELECT State,City,AvgAge,TotalSalary FROM
(
SELECT state, city, AVG( age ) AS AvgAge, SUM( salary ) AS TotalSalary
FROM customer
WHERE state >= 'A' AND city >= 'A'
GROUP BY state, city
WITH ROLLUP
) C
ORDER BY State,city
ENDTEXT
oRs := oCn:RowSet( cSql )
aSum := { oRs:Fields( "AvgAge" ):Value, oRs:Fields( "TotalSalary" ):Value }
oRs:SetFilter( "state >= 'A'" )
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 480,500 PIXEL TRUEPIXEL FONT oFont
@ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE oRs AUTOCOLS ;
CELL LINES NOBORDER FOOTERS
WITH OBJECT oBrw
:AvgAge:cFooter := aSum[ 1 ]
:TotalSalary:cFooter := aSum[ 2 ]
:AutoFit()
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( ;
oBrw:SetTree( 2, { FWDArrow(), FWRArrow() } ), ;
oBrw:bClrStds := { || { CLR_BLACK, If( oBrw:oTreeItem:nLevel == 1, 0x68DDFB, CLR_WHITE ) } } ;
)
RELEASE FONT oFont
oCn:Close()
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 65 guests