Subject Re: rowset.count()
From Andy <andy.taylor.1959@outlook.com>
Date Mon, 09 Sep 2019 15:24:19 -0400
Newsgroups dbase.getting-started

Vic,

Second attempt.. hoping I don't press the send button too early again by accident.
My first reply attempted to show the approach I took to putting the old XML commands into OOP code.
This was an idiotic thing to do ... as I'd have to explain how the custom table object and all it's methods worked.

So the below just shows the essential XML commands which work at lightning speed...

Let's say your table is called "ManyRecords.dbf" and your Filter in your query object is "Amount > 500"  

Try inserting the following code where you want to get the count...

use ManyRecords in select()
set filter to Amount > 500
private nCount; count to nCount
set filter to
use "" in ManyRecords
msgbox(""+nCount+" records")

This is just a (speedy) alternative.
Andy

> > thanks , Ken !
> >
> > getting (-1) as a result of rowset.rowcount()
> >
> > So, I had to count it one by one (table in not very big) but it
> > is no  good anyhow
> >
> > Best Regards
> > Victor
> >
> >
> > Ken Mayer Wrote:
> >
> > > On 9/6/2019 7:33 AM, Vic wrote:
> > > > Hi, everybody !
> > > >
> > > > I do filter rowset (depending on user\'s wish) through rowset.canGetRow
> > > > function. rowset is well updated in grid. Still rowset.count() return the same
> > > > number of rows. doesn\'t it respect filtering or my code is wrong ? :
> > > >
> > >
> > > No, it doesn\'t. The count() method returns the full number or rows in
> > > the table every time. Try using rowset.rowCount() instead.
> > >
> > > Ken
> > >
> > >
> > > --
> > > *Ken Mayer*
> > > Ken\'s dBASE Page: http://www.goldenstag.net/dbase
> > > The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
> > > dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
> > > dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
> >
>