oBrw:report() prints too much

oBrw:report() prints too much

Postby hag » Sun Sep 14, 2008 5: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
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby James Bott » Sun Sep 14, 2008 9: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby hag » Mon Sep 15, 2008 5: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?



Code: Select all  Expand view
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
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby James Bott » Mon Sep 15, 2008 5: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby hag » Mon Sep 15, 2008 6:36 pm

Thanks... Be testing when I get home later today.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby nageswaragunupudi » Mon Sep 15, 2008 6: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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby nageswaragunupudi » Mon Sep 15, 2008 7: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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Enrico Maria Giordano » Mon Sep 15, 2008 8: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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » 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.

Code: Select all  Expand view
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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

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

Postby James Bott » Tue Sep 16, 2008 2: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby nageswaragunupudi » Tue Sep 16, 2008 2: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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby hag » Tue Sep 16, 2008 2:57 am

James, Rao:

Code: Select all  Expand view
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
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby nageswaragunupudi » Tue Sep 16, 2008 3:50 am

In the method Report( ... )

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

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

Postby hag » Tue Sep 16, 2008 5:20 am

Thanks for the help but not working
Code: Select all  Expand view
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
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Next

Return to FiveWin for Harbour/xHarbour

Who is online

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