Crash after oBrw:Report()
Posted: Tue May 27, 2008 8:59 am
Hi guys:
After doing a oBrw:Report() I tried to Create a report and the program crashes. What's wrong in this piece of code ?
Code:
FUNCTION Main()
LOCAL oDlg, oBrw, oReport, oFont1, oFont2, cTimeStamp
SET CENTURY ON
USE Test NEW
SET INDEX TO Test
DEFINE DIALOG oDlg;
SIZE 800, 600
@ 0, 0 LISTBOX oBrw FIELDS
oBrw:bLine := &( "{ || { Name, Lastname } }" )
ACTIVATE DIALOG oDlg;
ON INIT oDlg:SetControl( oBrw );
CENTER
oBrw:Report()
GO TOP
DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-10
DEFINE FONT oFont2 NAME "ARIAL" SIZE 0,-10 BOLD
cTimeStamp := "Fecha: " + DTOC(DATE()) + " Hora: " + TIME()
REPORT oReport TITLE "*** My First Report ***" ;
CAPTION "Reporte De Cuentas A Cobrar" ;
HEADER cTimeStamp ;
FONT oFont1, oFont2 ;
FOOTER "Pagina: " + LTRIM(STR(oReport:nPage,5)) CENTER ;
PREVIEW
COLUMN TITLE "First Name" DATA Test->Name
COLUMN TITLE "Last Name" DATA Test->Lastname
COLUMN TITLE "Balance Due", "Ultimo Pago" DATA Test->Balance, Test->Lastpmt ;
PICTURE "$99,999.99", "D" TOTAL RIGHT SHADOW
GROUP ON Test->Pat_city ;
FOOTER "Ciudad:" + TRIM(oReport:aGroups[1]:cValue) + ;
STR(oReport:aGroups[1]:nCounter,4) ;
FONT 2
GROUP ON Test->Pat_lastn ;
FOOTER " Total Para Cliente " + TRIM(oReport:aGroups[2]:cValue) + ": " + ;
STR(oReport:aGroups[2]:nCounter,4) ;
FONT 2
END REPORT
oReport:lsummary := .T.
oReport:aGroups[2]:bFootFont := {|| 2}
ACTIVATE REPORT oReport ON STARTGROUP JumpLines(@oReport, 2)
oFont1:End()
oFont2:End()
CLOSE ALL
RETURN NIL
Error Message:
Error description: Error BASE/1132 Bound error: array access
Called from: => LOCKERRHAN(0)
Called from: => (b)INITHANDL$(0)
Called from: => TPREVIEW:BUILDWINDO(0)
Called from: => TPREVIEW:NEW(0)
Called from: => RPREVIEW(0)
Called from: => (b)NEW(0)
Called from: => TREPORT:ACTIVATE(0)
Called from: => MAIN(69)
After doing a oBrw:Report() I tried to Create a report and the program crashes. What's wrong in this piece of code ?
Code:
FUNCTION Main()
LOCAL oDlg, oBrw, oReport, oFont1, oFont2, cTimeStamp
SET CENTURY ON
USE Test NEW
SET INDEX TO Test
DEFINE DIALOG oDlg;
SIZE 800, 600
@ 0, 0 LISTBOX oBrw FIELDS
oBrw:bLine := &( "{ || { Name, Lastname } }" )
ACTIVATE DIALOG oDlg;
ON INIT oDlg:SetControl( oBrw );
CENTER
oBrw:Report()
GO TOP
DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-10
DEFINE FONT oFont2 NAME "ARIAL" SIZE 0,-10 BOLD
cTimeStamp := "Fecha: " + DTOC(DATE()) + " Hora: " + TIME()
REPORT oReport TITLE "*** My First Report ***" ;
CAPTION "Reporte De Cuentas A Cobrar" ;
HEADER cTimeStamp ;
FONT oFont1, oFont2 ;
FOOTER "Pagina: " + LTRIM(STR(oReport:nPage,5)) CENTER ;
PREVIEW
COLUMN TITLE "First Name" DATA Test->Name
COLUMN TITLE "Last Name" DATA Test->Lastname
COLUMN TITLE "Balance Due", "Ultimo Pago" DATA Test->Balance, Test->Lastpmt ;
PICTURE "$99,999.99", "D" TOTAL RIGHT SHADOW
GROUP ON Test->Pat_city ;
FOOTER "Ciudad:" + TRIM(oReport:aGroups[1]:cValue) + ;
STR(oReport:aGroups[1]:nCounter,4) ;
FONT 2
GROUP ON Test->Pat_lastn ;
FOOTER " Total Para Cliente " + TRIM(oReport:aGroups[2]:cValue) + ": " + ;
STR(oReport:aGroups[2]:nCounter,4) ;
FONT 2
END REPORT
oReport:lsummary := .T.
oReport:aGroups[2]:bFootFont := {|| 2}
ACTIVATE REPORT oReport ON STARTGROUP JumpLines(@oReport, 2)
oFont1:End()
oFont2:End()
CLOSE ALL
RETURN NIL
Error Message:
Error description: Error BASE/1132 Bound error: array access
Called from: => LOCKERRHAN(0)
Called from: => (b)INITHANDL$(0)
Called from: => TPREVIEW:BUILDWINDO(0)
Called from: => TPREVIEW:NEW(0)
Called from: => RPREVIEW(0)
Called from: => (b)NEW(0)
Called from: => TREPORT:ACTIVATE(0)
Called from: => MAIN(69)