Page 1 of 1

Printing an oBrw array

Posted: Mon May 26, 2014 8:44 pm
by hag
I have a xBrowse display using an array. Works fine. Lost on how to figure out how to pint the array. Help please.

Re: Printing an oBrw array

Posted: Tue May 27, 2014 4:27 am
by Richard Chidiak
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)

Re: Printing an oBrw array

Posted: Tue May 27, 2014 5:13 pm
by hag
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: Select all

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)

Re: Printing an oBrw array

Posted: Tue May 27, 2014 5:46 pm
by Richard Chidiak
Harvey

try it this way

DATA menucon3[nField][01]

Richard

Re: Printing an oBrw array

Posted: Tue May 27, 2014 6:28 pm
by hag
Bound array error

Re: Printing an oBrw array

Posted: Tue May 27, 2014 6:53 pm
by Richard Chidiak
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

Re: Printing an oBrw array

Posted: Tue May 27, 2014 7:07 pm
by hag
I took out the comma. Still get the error.

Re: Printing an oBrw array

Posted: Tue May 27, 2014 7:08 pm
by hag
the error is at the activate line.

Re: Printing an oBrw array

Posted: Wed May 28, 2014 6:18 am
by Richard Chidiak
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: Select all

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)

 

Re: Printing an oBrw array

Posted: Wed May 28, 2014 8:02 am
by nageswaragunupudi
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: Select all

oBrw:Report()

Re: Printing an oBrw array

Posted: Thu May 29, 2014 12:00 am
by hag
Thanks for all the help. oBrw:report( ) worked








0