report xbrowse method

User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

report xbrowse method

Post by Silvio »

How I can use the method report on xbrowse ?
I try with Action oApp:oGrid:Report( "Elenco Mezzi", .t., .t., )
but not run why ?
Best Regards, Saludos

Falconi Silvio
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

Report is working for me. It does not run only if it can not find printer. Please see these lines in the report method:

Code: Select all


   oPrn :=  PrintBegin( nil, ;            // document
                        .F., ;            // luser
                        lPreview, nil, ;  // xmodel
                        lModal, .F. )     // lselect

    if oPrn:hDC == 0
        return .f.                  // < ---  Your program may be returning here
    endif
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

but if use obrw:report()
it must run ok or not ?
Best Regards, Saludos

Falconi Silvio
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

It runs, if printer is attached
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

I try but it make error
see it please


DEFINE VMENUITEM OF oApp():oCont2 CAPTION "Stampa Elenco Automezzi" IMAGE "BB12" Action oApp:oGrid:Report( "Elenco Mezzi", .t., .t., )

Code: Select all

Application
===========
   Path and name: C:\work\prg\VDSWIN\VdsWin.Exe (32 bits)
   Size: 2,529,792 bytes
   Time from start: 0 hours 0 mins 6 secs 
   Error occurred at: 07/03/2008, 10:53:26
   Error description: Error BASE/1004  Class: 'NIL' has no exported method: EVAL
   Args:
     [   1] = U   

Stack Calls
===========
   [b]Called from:  => EVAL(0)
   Called from: RCOLUMN.PRG => TRCOLUMN:STABILIZE(0)
   Called from: REPORT.PRG => (b)TREPORT:STABILIZE(0)
   Called from:  => AEVAL(0)
   Called from: REPORT.PRG => TREPORT:STABILIZE(0)
   Called from: REPORT.PRG => TREPORT:ACTIVATE(0)
   Called from: XBROWSE.PRG => TXBROWSE:REPORT(0)
   Called from: ASS510.prg => (b)CAW510(272)[/b]
   Called from: VMenu.prg => TVMENU:EVALACTION(1700)
   Called from: VMenu.prg => TVMENU:LBUTTONUP(1398)
   Called from:  => TWINDOW:HANDLEEVENT(0)
   Called from: CONTROL.PRG => TCONTROL:HANDLEEVENT(0)
   Called from: VMenu.prg => TVMENU:HANDLEEVENT(905)
   Called from: WINDOW.PRG => _FWH(0)
   Called from:  => WINRUN(0)
   Called from: WINDOW.PRG => TWINDOW:ACTIVATE(0)
   Called from: main.prg => TAPPLICATION:ACTIVATE(269)
   Called from: main.prg => MAIN(55)
[/b]
Best Regards, Saludos

Falconi Silvio
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Hello Silvio,
I get the same error here.
Do you found a solution.

Regards,
Otto
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Otto, Silvio,

Could you please provide a small PRG to reproduce the error ? thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Thank you Antonio.
I sent a sample to reproduce the error to NageswaraRao.
I am sure he resolves the problem. Let’s wait for his answer.
Regards,
Otto
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Otto,

Would you mind to copy it here ? thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Dear Antonio, Dear Otto,

I remove the method Report from xbrowse and I add with another Method
because he method of Nas have problems

IF you go here you can see my method
http://www.fivetechsoft.com/forums/view ... wse+report

I publish it before of NageswaraRao But Antonio Not pubblished it !

this run ok !!!

Code: Select all

METHOD Print( lPreview, lModal, cTitle ) CLASS TXBrowse 

   local oPrn, oRep, oCol 
   local aCols 
   local xValue 
   local cAlias 
   local nFor, nLines, nLine, nBookMark 

   DEFAULT lPreview := .t.,; 
           lModal   := .f.,; 
           cTitle   := ::oWnd:cCaption 

   If Empty( cTitle ) 
      cTitle := "No Title" 
   Endif 

   If lPreview 
      If lModal 
         PRINTER oPrn NAME cTitle PREVIEW MODAL 
      else 
         PRINTER oPrn NAME cTitle PREVIEW 
      Endif 
   else 
      PRINTER oPrn NAME cTitle 
   Endif 

   If oPrn:hDC == 0 
      return .f. 
   Endif 

   If !Empty( ::cAlias ) 
      cAlias := DbSelectArea( ::cAlias ) 
   Endif 

   REPORT oRep TITLE "*** " + cTitle + " ***", "" ; 
      HEADER DToC( Date() ) + "-" + Left(Time(), 5), "" RIGHT ; 
      FOOTER "#: " + Str( oRep:nPage, 3 ) CENTER; 
      TO DEVICE oPrn 

   aCols := ::GetVisibleCols() 

   for nFor := 1 to len( aCols ) 
      If !aCols[nFor]:lHide 
         oCol := oRep:AddColumn( TrColumn():New( { FInfo1(aCols, nFor) } ,,; 
                                { FInfo2(aCols, nFor) },,,,,,,,,, oRep ) ) 
         xValue := Eval(aCols[nFor]:bStrData) 
         nLines := MlCount(xValue, 250) 
         oCol:nPad := aCols[nFor]:nDataStrAlign + 1 
         If nLines > 1 
            oCol:aData    := Array(nLines) 
            oCol:aPicture := Afill(Array(nLines), "") 
            For nLine := 1 to nLines 
               oCol:aData[nLine] := FInfo3(aCols, nFor, nLine) 
            Next 
         Endif 
      Endif 
   next 

   ENDREPORT 

   nBookMark := Eval( ::bBookMark ) 

   If ::aArrayData != nil .and. len( ::aArrayData ) > 0 
      ::nArrayAt := 1 
      oRep:bSkip  := { || ::nArrayAt++ } 
      ACTIVATE REPORT oRep WHILE ::nArrayAt <= len( ::aArrayData ) ON END ::nArrayAt := 1 
   else 
      ACTIVATE REPORT oRep 
   Endif 

   Eval(::bBookMark, nBookMark ) 

   If !Empty( cAlias ) 
      DbSelectArea( cAlias ) 
   Endif 

return .t. 
Best Regards, Saludos

Falconi Silvio
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Falconi,

Since xBrowse can now also handle database objects, it would be nice if your report method could handle them too.

I also suggest adding a gotop() before the report and saving and restoring the current recno().

James
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

I would not have made this posting except for the reason that my name is mentioned above.

The present report method of xbrowse is working quite well for me. I find it quite versatile. It can handle arrays, rdd and also objects. That too objects of any kind. It can handle grouping and subgrouping comfortably.

If we select only some rows of the browse with shift-click / ctrl-click, it prints only those selected rows. Users are extremely happy with this feature.

Possible that in some cases there is the error that is reported which I hope Mr Antonio will fix it, if we provide him with a sample.

It is true Mr Otto mentioned to me about his problem, but he did not send his sample to me so far. Even if he sent I don't know if I could find a solution.

The print method published by Mr Silvio is verbatim reproduction the print method in the old xbrowse of Ozlib, including a bug in it. ( In the olden days I used to use a corrected version ). I changed to FWH xbrowse long back following my decision not to use 3rd party libraries. Glad FWH improved xbrowse a lot.

The report method of FWH is definitely far advanced with very useful features and the coding approach is totally data source neutral unlike the code posted as comparision. That means the report method will work the same way whatever is the data source.
Last edited by nageswaragunupudi on Mon May 12, 2008 7:28 pm, edited 1 time in total.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

It is found that this error is occurring when for a column only bBmpData is assigned, leaving bEditValue and bStrData as NIL. This problem is fixed in FWH 8.05, by skipping such columns in the report method.

Temporary fix is to hide such columns before using report method.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

Thanks Mr Antonio. This explains why I never got this problem. All my browses have bEditValue assigned. Even when I use bitmaps it depeneded on the bEditValue.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

Mr James
James Bott wrote:Falconi,

Since xBrowse can now also handle database objects, it would be nice if your report method could handle them too.

I also suggest adding a gotop() before the report and saving and restoring the current recno().

James
XBrowse Report method does this gracefully.
Regards

G. N. Rao.
Hyderabad, India
Post Reply