FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour oBrw:report() prints too much
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
oBrw:report() prints too much
Posted: Sun Sep 14, 2008 05:31 PM

Using oBrw:report() to print a browse.

The print seems to print the entire data base and not stoping where the filter says to stop.

It prints 5 extra page headers with no data below the header. The data is filtered out so there shoud be no data but it is printing 5 extra pages all with a header.

How do I shut it off at the end of the browse and prevent the extra pages?
All ideas appreciated.

Thank you

Harvey
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
oBrw:report() prints too much
Posted: Sun Sep 14, 2008 09:36 PM

Harvey,

The problem seems to be that the xbrowse:Report() method is doing this:

oRep:bWhile := { || oRep:nCounter < nRows }

Where nRows = ordKeyCount(), and this won't work with a filter.

I think you are going to have to use the report setup method (that was discussed in another message thread) to change the oRpt:bWhile codeblock. Try using:

oRpt:bWhile := {|| ! eof() }

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
oBrw:report() prints too much
Posted: Mon Sep 15, 2008 05:28 PM
James:

Couple of questions

You said
> oRpt:bWhile := {|| ! eof() }
Are you suggesting modify the xbrowse class?

How does the !eof() get the print to stop at end of filter and not print extra pages?



I think you are going to have to use the report setup method (that was discussed in another message thread) to change the oRpt:bWhile codeblock. Try using:


I can't find the thread. Could you send me a link.

BTW are you and I the only people on this site from Calif?
Thank you

Harvey
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
oBrw:report() prints too much
Posted: Mon Sep 15, 2008 05:55 PM

Harvey,

>Couple of questions

>You said
>> oRpt:bWhile := {|| ! eof() }
>Are you suggesting modify the xbrowse class?

No.

>How does the !eof() get the print to stop at end of filter and not print extra pages?

Because eof() respects filters and ordKeyCount() apparently doesn't.

>I think you are going to have to use the report setup method (that was discussed in another message thread) to change the oRpt:bWhile codeblock. Try using:

>I can't find the thread. Could you send me a link.

Try something like this:

DEFINE BUTTON OF oBar PROMPT 'Print' ;
ACTION oBrw:Report( 'TestReport', , , ;
{ |oRep| oRpt:bWhile := {|| ! eof() } } )

>BTW are you and I the only people on this site from Calif?

Tim Stone is also up there in the LA area somewhere--I forget exactly. There are only the three of us in CA that I know.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
oBrw:report() prints too much
Posted: Mon Sep 15, 2008 06:36 PM

Thanks... Be testing when I get home later today.

Thank you

Harvey
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
oBrw:report() prints too much
Posted: Mon Sep 15, 2008 06:46 PM

Its a problem and the above suggestion also does not help for two reasons.

  1. Report method sets oRep:bWhile after evaluating user codeblock
  2. Even if we modify xbrowse source, xbrowse navigation never retults in eof(). ( This report will never stop !!!! )

This needs a different kind of fix ( I dont know yet ) in the xbrowse program

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
oBrw:report() prints too much
Posted: Mon Sep 15, 2008 07:01 PM

My view:
XBrowse Report method needs a fix.
While the present oRep:bSkip and oRep:bWhile blocks may be retained for non - dbf datasources, if the ::calias is not empty, oRep:bSkip should be { |n| (::cAlias)->( DbSkip( n ) ) } and oRep:bWhile should be { || ! ( ::cAlias)->( Eof () ) }

I did not experience this because mostly i use record sets and ADS for DBFs with my own modified RDDADS and my AdsKeyCount respects filters. Thanks for bringing out this issue. Hope Mr Antonion will advise a better fix.

Another issue is what is a better way to ascertain the total visible records in DBF when filters are set ?

Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
oBrw:report() prints too much
Posted: Mon Sep 15, 2008 08:09 PM
James Bott wrote:Because eof() respects filters and ordKeyCount() apparently doesn't.


Yes. OrdKeyCount() just count the record in the controlling index.

EMG
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
oBrw:report() prints too much
Posted: Mon Sep 15, 2008 10:50 PM
Harvey,

>Report method sets oRep:bWhile after evaluating user codeblock

NageswaraRao, has a good point. You cannot use the bWhile that I suggested.

I suggest trying his idea about changing the bSkip and bWhile in the TXBrowe:Report method to test if that works for you. If so, perhaps we can get Antonio to make those changes to the FWH source. Put this right before the oRep:Activate() in the TXBrowse:Report() method.

if ! empty(::cAlias)
   oRep:bSkip := { |n| (::cAlias)->( DbSkip( n ) ) }
   oRep:bWhile := { || ! ( ::cAlias)->( Eof () ) } 
endif


Another option is not to use filters; can you use scopes instead? Scopes might work with xbrowse as it is now.

Or, you can just write your own report using TReport instead of using the xBrowse:Report() method.

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
oBrw:report() prints too much
Posted: Mon Sep 15, 2008 11:55 PM

>
Another option is not to use filters; can you use scopes instead? Scopes might work with xbrowse as it is now.
>

Or, you can just write your own report using TReport instead of using the xBrowse:Report() method.
>

I suggest we better do this temporary fix to xbrowse now and Mr Antonio would do this or a better fix in the next release. When we have xbrowse, no point losing our independence or make our own reports.

Again, can any one reflect on my question: How to find the number of visible records after setting a filter in DBFCDX and DBFNTX ?

Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
oBrw:report() prints too much
Posted: Tue Sep 16, 2008 02:16 AM

NageswaraRao,

>Again, can any one reflect on my question: How to find the number of visible records after setting a filter in DBFCDX and DBFNTX ?

I think you would have to count them by skipping through the database. If you use the eof() you don't have to deal with this.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
oBrw:report() prints too much
Posted: Tue Sep 16, 2008 02:33 AM

AdsGetKeyCount() and AdsGetRecordCount() provide flags ADS_RESPECTFILTERS, ADS_RESPECTSCOPES, etc.

Wish DBFCDX also provides similar functionality. When the filters are fully optimized it is just a matter of reading from the filter bitmaps. It would be nice if (x)Harbour development teams provide similar functionality. Till Clipper 5.2 I was using rl_* functions of Comix for this and after that I moved over to ADS ( client-server )

ADS local server has same functonality as DBFCDX and appears to be more useful than DBFCDX, and I wonder for what reasons we should prefer DBFCDX over ADS local server ( which is free ).

I dont know if other drivers of harbour like SIX, etc provide similar functionality

Regards



G. N. Rao.

Hyderabad, India
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
oBrw:report() prints too much
Posted: Tue Sep 16, 2008 02:57 AM
James, Rao:

if ! empty(::cAlias) 
   oRep:bSkip := { |n| (::cAlias)->( DbSkip( n ) ) } 
   oRep:bWhile := { || ! ( ::cAlias)->( Eof () ) } 
endif

Where do I put this in the report.prg or xbrowse.prg and where?
I'm lost

Harvey
Thank you

Harvey
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
oBrw:report() prints too much
Posted: Tue Sep 16, 2008 03:50 AM

In the method Report( ... )

After the line :
oRep:bEnd := ::bGoTop
and
before the line
oRep:Activate()

Regards



G. N. Rao.

Hyderabad, India
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
oBrw:report() prints too much
Posted: Tue Sep 16, 2008 05:20 AM
Thanks for the help but not working
oRep:bEnd        := ::bGoTop

if !empty(::cAlias) 
   oRep:bSkip := { |n| (::cAlias)->( DbSkip( n ) ) } 
	 oRep:bWhile := { || ! ( ::cAlias)->( Eof () ) } 
endif

oRep:Activate()


Not working...

Any other thoughts?
Thank you

Harvey