XBREPORT : Less known features of FWH- 1

XBREPORT : Less known features of FWH- 1

Postby nageswaragunupudi » Tue Jul 30, 2013 7: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: Select all  Expand view

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: Select all  Expand view

#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:
Image

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: Select all  Expand view

#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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBREPORT : Less known features of FWH- 1

Postby nageswaragunupudi » Tue Jul 30, 2013 8:06 pm

Example of Image and memo handling. Again with single line code.

Code: Select all  Expand view
#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)

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


Image
Regards

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

Re: XBREPORT : Less known features of FWH- 1

Postby elvira » Tue Jul 30, 2013 9: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;)
elvira
 
Posts: 516
Joined: Fri Jun 29, 2012 12:49 pm

Re: XBREPORT : Less known features of FWH- 1

Postby nageswaragunupudi » Tue Jul 30, 2013 9: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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBREPORT : Less known features of FWH- 1

Postby joseluisysturiz » Sun Jul 30, 2017 1: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!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: XBREPORT : Less known features of FWH- 1

Postby nageswaragunupudi » Sun Jul 30, 2017 2: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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBREPORT : Less known features of FWH- 1

Postby joseluisysturiz » Sun Jul 30, 2017 4: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=6&t=34359&p=204151#p204151
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: XBREPORT : Less known features of FWH- 1

Postby nageswaragunupudi » Sun Jul 30, 2017 6:28 am

Simple example of using XBREPORT:
Code: Select all  Expand view
 
#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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBREPORT : Less known features of FWH- 1

Postby joseluisysturiz » Sun Jul 30, 2017 3:18 pm

nageswaragunupudi wrote:Simple example of using XBREPORT:
Code: Select all  Expand view
 
#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... :shock:

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... :shock:

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... :shock:

Gracias / Thanks... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 81 guests