xBrowse report oLbx:Report

xBrowse report oLbx:Report

Postby Rick Lipkin » Fri Jul 13, 2018 5:26 pm

To All

Is it possible to select ONLY the fields you wish xBrowse report to Print and also get a total number of records ?

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse report oLbx:Report

Postby nageswaragunupudi » Sat Jul 14, 2018 5:54 am

The only way is to hide the unwanted columns and call :Report().
This also means that Report() method prints what we see in the browse by default.
Total records printed is oBrw:nLen.

By using the 4th parameter bSetup, you get the full flexibility to define your own columns.
Example:
Code: Select all  Expand view  RUN
#include "fivewin.ch"
#include "report.ch"

function Main()

   local oDlg, oBrw, oCn, oRs

   oCn   := FW_OpenAdoConnection( "xbrtest.mdb" )
   oRs   := FW_OpenRecordSet( oCn, "customer" )

   DEFINE DIALOG oDlg SIZE 500,300 PIXEL TRUEPIXEL

   @ 60,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE oRs COLUMNS "First", "City", "Age" ;
      CELL LINES NOBORDER

   oBrw:CreateFromCode()

   @ 20,20 BUTTON "REPORT" SIZE 80,30 PIXEL OF oDlg ;
      ACTION oBrw:Report( nil, nil, nil, { |oRep,brw| MyReportSetup( oRep, brw ) } )

   ACTIVATE DIALOG oDlg CENTERED

   oRs:Close()
   oCn:Close()

return nil

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

function MyReportSetup( oRep, oBrw )

   local oRs   := oBrw:oRs
   local cLines   := cValToChar( oBrw:nLen ) + " lines"

   COLUMN TITLE "First Name" DATA oRs:Fields( "First" ):Value SIZE 25
   COLUMN TITLE "Street"     DATA oRs:Fields( "Street" ):Value SIZE 25
   COLUMN TITLE "City"       DATA oBrw:City:Value SIZE 25
   COLUMN TITLE "Salary"     DATA oRs:Fields( "salary" ):Value PICTURE "999,999.99" TOTAL

   oRep:bPostEnd   := { || oRep:Say( 1, cLines ) }

return .t.

// return .t. means xbrowse should not add columns
//----------------------------------------------------------------------------//
 


The report has some columns that are not even seen in the xbrowse and some columns are used from the browse.
Regards

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

Re: xBrowse report oLbx:Report

Postby Rick Lipkin » Sat Jul 14, 2018 1:21 pm

Rao

I am using FWH 1707 and your example errors during the compile at:
Code: Select all  Expand view  RUN

 COLUMN TITLE "First Name" DATA oRs:Fields( "First" ):Value SIZE 25
 


"Syntax error at Title" ... is this because I am using an older version of FWH ? and is there a work around ?

Thanks
Rick Lipkin

ps .. just curious about what are the first three parameters .. I will have a look at my xBrowse.Prg .. again, perhaps my FWH is just too old?
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse report oLbx:Report

Postby nageswaragunupudi » Sat Jul 14, 2018 1:24 pm

This works in all versions.

Need to include "report.ch" also.

Parameters
Code: Select all  Expand view  RUN
METHOD Report( cTitle, lPreview, lModal, bSetUp, aGroupBy, cPDF )
Regards

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

Re: xBrowse report oLbx:Report

Postby Rick Lipkin » Sat Jul 14, 2018 1:31 pm

Rao

Thanks .. that worked ... how do you apply

Code: Select all  Expand view  RUN

 oBrw:nLen
 


to show up at the bottom of the report to sum the number of records ?

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse report oLbx:Report

Postby nageswaragunupudi » Sat Jul 14, 2018 2:29 pm

Please see my modification.
Regards

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

Re: xBrowse report oLbx:Report

Postby Rick Lipkin » Sat Jul 14, 2018 2:38 pm

Rao

As always ... Thank you!

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

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