FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Printing an oBrw array
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Printing an oBrw array
Posted: Mon May 26, 2014 08:44 PM

I have a xBrowse display using an array. Works fine. Lost on how to figure out how to pint the array. Help please.

Thank you

Harvey
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: Printing an oBrw array
Posted: Tue May 27, 2014 04:27 AM
Harvey

this is a sample ,

Hth

Richard



REPORT oREPORT ;
......
COLUMN TITLE "Date Visite" ;
DATA TVISU[nField][02];
FONT 2 ;
GRID 2
COLUMN TITLE "Heure" ;
DATA TVISU[nField][03];
GRID 2
COLUMN TITLE "Ouvrier" ;
DATA TVISU[nField][06];
SIZE 20 ;
FONT 1 ;
GRID 1
END REPORT

oReport:bSkip := {|| nField++}

ACTIVATE REPORT oREPORT WHILE nField <= len(TVISU)

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Re: Printing an oBrw array
Posted: Tue May 27, 2014 05:13 PM
Thanks for the quick response. Tried it but I get a bound array access. Here is the code maybe you can tell me what I'm doing wrong.
Code (fw): Select all Collapse
static function printIt()

   local oFont4 
   local oReport,oPen1, oPrn, oRep
     local nVar := 1, nField := 1
   local menucon3[3,03]


   for i = 1 to 3
      menucon3[i,1]  := "hag1"
      menucon3[i,2]  := "hag2"
      menucon3[i,3]  := "hag3"
   next i
                        
        
   if nVar == 1
      DEFINE FONT oFont4 NAME "Arial narrow" SIZE 0,-5.85 BOLD //of oRep:oDevice        
   else 
      DEFINE FONT oFont4 NAME "Arial narrow" SIZE 0,-6.25 BOLD //of oRep:oDevice        
   endif    
   define pen oPen1 width 1
   PRINT oPrn NAME "Profit and Loss"

  prnlandscape()
        
  ENDPRINT

     REPORT oReport ;
              TITLE rtrim(mcompname);
              FONT  oFont4,oFont4;
              PEN oPen1  ;
              HEADER "date";
              LEFT                      ;
              FOOTER OemtoAnsi("Footer");
              CENTERED                                ;
              PREVIEW                   ;
              CAPTION "Previewing Profit & Loss"
                            
              oReport:nTitleUpLine := RPT_NOLINE


   oReport:aFont[1] :=  oFont4
                        
   COLUMN TITLE "No." ;
   DATA menucon3[nField],[01];
   FONT oFont4 ;
   GRID 

   COLUMN TITLE "Name" ;
   DATA menucon3[nField],[02];
   FONT oFont4  ;
   GRID 

   COLUMN TITLE "Total" ;
   DATA menucon3[nField],[03];
   SIZE 20 ;
   FONT oFont4  ;
   GRID 

END REPORT

oReport:bSkip := {|| nField++}

ACTIVATE REPORT oReport WHILE nField <= len(menucon3)

Thank you

Harvey
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: Printing an oBrw array
Posted: Tue May 27, 2014 05:46 PM

Harvey

try it this way

DATA menucon3[nField][01]

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Re: Printing an oBrw array
Posted: Tue May 27, 2014 06:28 PM

Bound array error

Thank you

Harvey
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: Printing an oBrw array
Posted: Tue May 27, 2014 06:53 PM

Harvey

i am refering to this in particular

DATA menucon3[nField],[01]

should be replaced with DATA menucon3[nField][01]

The comma in the data syntax will specify a second data value

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Re: Printing an oBrw array
Posted: Tue May 27, 2014 07:07 PM

I took out the comma. Still get the error.

Thank you

Harvey
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Re: Printing an oBrw array
Posted: Tue May 27, 2014 07:08 PM

the error is at the activate line.

Thank you

Harvey
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: Printing an oBrw array
Posted: Wed May 28, 2014 06:18 AM
Harvey

there are several errors in your report definitions

i have made some changes and it compiles and run ok

the code is below

Richard

Code (fw): Select all Collapse
menucon3 := {}

AADD(MENUCON3,{"hag1",1,100})
AADD(MENUCON3,{"hag2",2,200})
AADD(MENUCON3,{"hag3",3,300})

   DEFINE FONT oFont4 NAME "Arial narrow" SIZE 0,-5.85 BOLD //of oRep:oDevice
   define pen oPen1 width 1

     REPORT oReport ;
              TITLE "This is a test";
              FONT  oFont4 ;
              PEN oPen1  ;
              HEADER "date";
              LEFT                      ;
              FOOTER OemtoAnsi("Footer");
              CENTERED                                ;
              PREVIEW                   ;
              CAPTION "Previewing Profit & Loss"


   COLUMN TITLE "Name" ;
   DATA menucon3[nField][02];
   FONT 1  ;
   GRID 1

   COLUMN TITLE "No." ;
   DATA menucon3[nField][01];
   FONT 1 ;
   GRID 1

   COLUMN TITLE "Total" ;
   DATA menucon3[nField][03];
   SIZE 20 ;
   FONT 1  ;
   GRID 1

END REPORT

oReport:bSkip := {|| nField++}

ACTIVATE REPORT oReport WHILE nField <= len(menucon3)
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Printing an oBrw array
Posted: Wed May 28, 2014 08:02 AM
hag wrote:I have a xBrowse display using an array. Works fine. Lost on how to figure out how to pint the array. Help please.


If you are already browsing the array, the simplest way to print is to call
Code (fw): Select all Collapse
oBrw:Report()
Regards



G. N. Rao.

Hyderabad, India
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Re: Printing an oBrw array
Posted: Thu May 29, 2014 12:00 AM

Thanks for all the help. oBrw:report( ) worked

0

Thank you

Harvey

Continue the discussion