FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBREPORT : Less known features of FWH- 1
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
XBREPORT : Less known features of FWH- 1
Posted: Tue Jul 30, 2013 07:50 PM
Most of us are aware of XBROWSER command and XBrowse(...) function. We also know how useful it is as a tool during development.

Sameway, there is a command XBREPORT which can be used to generate simple reports with just one or few lines of code. The syntax is almost like XBROWSE syntax. This command creates xbrowse in a hidden window and runs its Report method.

This command is useful when we quickly need to print a no-frills report.

In its simplest form :
Code (fw): Select all Collapse
USE CUSTOMER NEW
XBREPORT oTmp TITLE "CUSTOMERS" ALIAS "CISTOMER" AUTOCOLS
CLOSE CUSTOMER

With this one line of code the report is ready in preview.

The generated report is as good or as bad as any report generated by Xbrowse's Report() method. But to write the code required to generate the above code using REPORT command requires more time and many lines of code.

We may try these two samples:
Code (fw): Select all Collapse
#include "FiveWin.Ch"
#include "xbrowse.ch"

REQUEST DBFCDX

function Main()

   local oTmp, oRs

   SET DELETED ON
   FWNumFormat( "A", .t. )
   RPrevUserBtns( nil, 2010 )

   MsgInfo( "Quick Report from DBF" )
   USE CUSTOMER NEW ALIAS CUST SHARED READONLY VIA "DBFCDX"

   XBREPORT oTmp TITLE "CUSTOMERS" ;
      DATASOURCE "CUST" COLUMNS "FIRST", "LAST", "CITY", "STATE", "AGE", "SALARY" ;
      BRWSETUP { |oBrw| oBrw:Salary:nFooterType := AGGR_SUM } ;
      REPSETUP { |oRep| oRep:lJoin := .t., nil }

   CLOSE CUST

return (0)


Result:


We can use all clauses of the XBrowe command syntax lile headers, picture clauses, alignments, etc and can easily handle memos and pictures too,.


We may try another example with a recordset:
Code (fw): Select all Collapse
#include "FiveWin.Ch"
#include "xbrowse.ch"

function Main()

   local oTmp, oRs

   XbrNumFormat( 'A', .t. )
   RPrevUserBtns( nil, 2010 )

   MsgInfo( "Quick Report from ADO" )
   oRs   := FW_OpenRecordSet( "xbrtest.mdb", "CUSTOMER" )
   XBREPORT oTmp TITLE "CUSTOMERS" ;
      DATASOURCE oRs COLUMNS "FIRST", "LAST", "CITY", "STATE", "AGE", "SALARY" ;
      BRWSETUP { |oBrw| oBrw:Salary:nFooterType := AGGR_SUM }
   oRs:Close()
   oRs:ActiveConnection:Close()

return (0)


This command is available in xbrowse.ch.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBREPORT : Less known features of FWH- 1
Posted: Tue Jul 30, 2013 08:06 PM
Example of Image and memo handling. Again with single line code.

Code (fw): Select all Collapse
#include "FiveWin.Ch"
#include "xbrowse.ch"

REQUEST DBFCDX

//----------------------------------------------------------------------------//

function Main()

   local oTmp, oRs

   RPrevUserBtns( nil, 2010 )

   USE WWONDERS NEW
   XBREPORT oTmp TITLE "WONDERS OF THE WORLD" DATASOURCE "WWONDERS" AUTOCOLS ;
      BRWSETUP { |oBrw| oBrw:Image:cDataType := 'P' }
   CLOSE DATA

return (0)

//----------------------------------------------------------------------------//


Regards



G. N. Rao.

Hyderabad, India
Posts: 518
Joined: Fri Jun 29, 2012 12:49 PM
Re: XBREPORT : Less known features of FWH- 1
Posted: Tue Jul 30, 2013 09:08 PM

Mr. Rao,

Very interesting feature.

I was wondering ifit could be posible to indicate these parameters:

  TITLE  oInforme:cTitulo1, oInforme:cTitulo2, iif(oInforme:cTitulo3!=NIL, oInforme:cTitulo3," ") CENTERED ;
      FONT   oInforme:oFont3, oInforme:oFont2, oInforme:oFont1 ;
              HEADER oSayEmpresa(), "Fecha: "+dtoc(Date()), "Hora:  "+Time() ;
      FOOTER "Página: "+str(oRep:nPage,3) ; 
      CAPTION "Vista Previa del Informe "+oInforme:cTitulo1  PREVIEW

I mean, several titles, fonts, the header, footer and caption.

Thank you very much.

Kind regards;)

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBREPORT : Less known features of FWH- 1
Posted: Tue Jul 30, 2013 09:21 PM

Let us first keep in mind that this facility is for generating no-frills reports almost instantly. Like XBrowser command this is also a tool that can be used during development.

This command has as much flexibilty as xbrowse's Report() method and has the same limitations of the Report() method.

We can customize the report's parameters with the clause
XBREPORT .............. REPSETUP { |oRep,n| <report setup code > }

This codeblock's functionality is the same as bSetUp parameter in oBrw:Report(...) method.

Let us try to improve the flexibility of xbrowse report() method in future versions of FWH, which automatically apply to this command also.

In any case this is not intended to be a replacement of a full featured report.

Incidentally from FWH 13.07 onwards Page numbers are automatically included at bottom center

Regards



G. N. Rao.

Hyderabad, India
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: XBREPORT : Less known features of FWH- 1
Posted: Sun Jul 30, 2017 01:09 AM

Saludos, no conocia esta clase, ha habido alguna mejora en la misma o simplemente murio alli.? saludos, gracias... :shock:

Dios no está muerto...



Gracias a mi Dios ante todo!
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBREPORT : Less known features of FWH- 1
Posted: Sun Jul 30, 2017 02:06 AM

XBREPORT still works.
It is not a class. It is just a command which exploits the power and simplicity of xbrowse.

Regards



G. N. Rao.

Hyderabad, India
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: XBREPORT : Less known features of FWH- 1
Posted: Sun Jul 30, 2017 04:32 AM

Greetings mr NAGE, I express badly with CLASS, what I wanted to know is if this function was still active, since I had never read or seen comments, so much so that the last date touched on the subject was in 2013, I will revise The function to help me with the quick reports for what I see was created, thanks for your attention and fast help as always, greetings, thank you ...

If I could review this topic, I'll start working on the xbrowse, thanks ...

viewtopic.php?f=6t=34359p=204151#p204151

&&

Dios no está muerto...



Gracias a mi Dios ante todo!
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBREPORT : Less known features of FWH- 1
Posted: Sun Jul 30, 2017 06:28 AM
Simple example of using XBREPORT:
Code (fw): Select all Collapse
   
#include "fivewin.ch"

function Main()

   local oXbRep

   USE STATES
   XBREPORT oXbRep DATASOURCE "STATES" TITLE "List of Sates"
   return nil


About the other post:
I am not fully clear of what you want from me.
Regards



G. N. Rao.

Hyderabad, India
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: XBREPORT : Less known features of FWH- 1
Posted: Sun Jul 30, 2017 03:18 PM
nageswaragunupudi wrote:Simple example of using XBREPORT:
Code (fw): Select all Collapse
   
#include "fivewin.ch"

function Main()

   local oXbRep

   USE STATES
   XBREPORT oXbRep DATASOURCE "STATES" TITLE "List of Sates"
   return nil


About the other post:
I am not fully clear of what you want from me.



About the other post:

joseluisysturiz escribió:
Se puede usar algo como el autoget en una edicion de celda en un xBrowse.? si es asi, algun sample...saludos...gracias... :-)

your answer:
Use EDIT_LISTBOX or EDIT_GET_LISTBOX

my answer:
Google translator:
Mr. NAG, I have not yet defined the xBrowse, if I could put a sample of both options or which one would recommend me? Is for a billing and the data entry will be in an ARRAY and the data source of a MYSQL table ... greetings, thanks... :-)

Mr. NAG, aun no he definido el xBrowse, si podria colocar un sample de ambas opciones o cual me recomendaria.? es para una facturacion y la entrada de datos sera en un ARRAY y el origen de los datos de una tabla MYSQL...saludos, gracias... :-)

Gracias / Thanks... :-)
Dios no está muerto...



Gracias a mi Dios ante todo!

Continue the discussion