|
Home > Archive > dBASE Bugs > February 2006 > Rowcount()
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Alan Fitch 2006-01-16, 9:23 am |
| The following cut from OLH
rowCount(_) returns the logical row count of the rowset, if known. The logical row count is the number of rows in the rowset, using the rowset's current index and filter conditions.
Not correct. It may return the rowcount on a full index but it returns -1 on a unique index.
How do I quickly count the rows in a unique index rowset?
Regards
Alan
| |
| Bruce Beacham 2006-01-16, 11:29 am |
| Alan Fitch wrote:
> How do I quickly count the rows in a unique index rowset?
use <tablename> order <uniqueindexname>
count to xx // xx will then contain the count.
use
Bruce Beacham
| |
| kathy kolosky 2006-01-16, 1:23 pm |
| Hi Alan. What database / version are you using?
- Kathy
QA
dBI
"Alan Fitch" <awjkfitch@aol.com> wrote in message
news:uEjv4fqGGHA.1560@news-server...
> The following cut from OLH
>
> rowCount( ) returns the logical row count of the rowset, if known. The
> logical row count is the number of rows in the rowset, using the rowset's
> current index and filter conditions.
>
> Not correct. It may return the rowcount on a full index but it returns -1
> on a unique index.
>
> How do I quickly count the rows in a unique index rowset?
>
> Regards
> Alan
| |
| Alan Fitch 2006-01-16, 8:24 pm |
| kathy kolosky Wrote:
> Hi Alan. What database / version are you using?
Sorry should have said,
dBase Plus 2.6.0.0 b1899
BDE 5.2.0.2
Alan
| |
| Alan Fitch 2006-01-16, 8:24 pm |
| Bruce Beacham Wrote:
> Alan Fitch wrote:
>
>
> use <tablename> order <uniqueindexname>
> count to xx // xx will then contain the count.
> use
>
Thanks Bruce
Have been trying to only use sql. This does resolve my problem - but sql should work.
Alan
| |
| kathy kolosky 2006-01-16, 8:24 pm |
| Thanks, Alan.
I submitted this as QAID 5703
- Kathy
QA
dBI
"Alan Fitch" <awjkfitch@aol.com> wrote in message
news:Ha8$6jtGGHA.1268@news-server...
> Bruce Beacham Wrote:
>
> Thanks Bruce
> Have been trying to only use sql. This does resolve my problem - but sql
> should work.
>
> Alan
>
| |
| Alan Fitch 2006-01-16, 8:24 pm |
| kathy kolosky Wrote:
> Thanks, Alan.
>
> I submitted this as QAID 5703
>
Thanks kathy.
| |
| Bruce Beacham 2006-01-17, 7:23 am |
| Alan Fitch wrote:
> Thanks Bruce Have been trying to only use sql. This does resolve my
> problem - but sql should work.
q = new query([select * from "] + <pathed/databased tablename> + ["])
q.rowset.indexname = "<myuniqueindexname>"
local xx
xx = 0
if q.rowset.first()
do
xx++
until not q.rowset.next()
endif
q.active = false
? xx
Bruce
| |
| Alan Fitch 2006-01-17, 9:23 am |
| Bruce Beacham Wrote:
> Alan Fitch wrote:
>
>
>
> q = new query([select * from "] + <pathed/databased tablename> + ["])
Thanks Bruce, I didn't know one could do the above.
The remainder is probably all that rowcount() does but it does not.
Alan
| |
| Marty Kay 2006-01-17, 11:24 am |
| Alan,
Are you using dBASE tables or a server DBMS?
The rowcount() method only returns a non-negative value if the BDE
determines that the count can be obtained inexpensively (i.e. quickly).
To perform a row by row count regardless of the expense, call the rowset's
count() method instead.
- Marty Kay (dBI) -
| |
| Bruce Beacham 2006-01-17, 8:24 pm |
| Alan Fitch wrote:
[color=darkred]
> Thanks Bruce, I didn't know one could do the above.
Glad to help. You can likewise activate a database:
d = new database("dbasesamples")
Bruce
| |
| Bruce Beacham 2006-01-17, 8:24 pm |
| Marty Kay wrote:
> To perform a row by row count regardless of the expense, call the rowset's
> count() method instead.
How I ever passed any exams I don't know. If I'd read the question
properly (which I read as count(), not rowcount()) I guess I might have
been more help!
Thanks for giving Alan the proper answer.
Bruce
| |
| Jean-Pierre Martel 2006-01-18, 3:23 am |
| In article <vu33ib4GGHA.2092@news-server>, mkay@databi.com says...
>
> To perform a row by row count regardless of the expense,
> call the rowset's count() method instead.
With a unique index, that method seems to return the total number of
rows, regardless of the index. Is that possible?
The rowset.count() method used to perform a row-by-row count and
consequently, used to be very slow. My impression is that it has been
replaced internally by its SQL equivalent (which was a lot faster) since
both are now about as fast.
Since the SQL command 'select DISTINCT count(*) as Total from
MyTable.dbf' also returns the total number of rows (not taking into
account the 'Distinct' clause), that might explain the bug in the
rowset.count() method.
Jean-Pierre Martel, editor
The dBASE Developers Bulletin
Blue Star dBASE Plus Core Concepts Graduate
| |
|
| Well I guess I was trying to responed to:
Jean-Pierre Martel
That didn't work.
I have a question:
Is the Bulletin still active?
No new news is no news and it has been March of last year since any news.
Seems there is no way to ask you a question on your web page - no mailto:
I tried here.
Thansk
John
"Jean-Pierre Martel" <nospam@nospam.com> wrote in message
news:MPG. 1e37951e5d8c1c5a9897
8a@news.dbase.com...
> In article <vu33ib4GGHA.2092@news-server>, mkay@databi.com says...
>
> With a unique index, that method seems to return the total number of
> rows, regardless of the index. Is that possible?
>
> The rowset.count() method used to perform a row-by-row count and
> consequently, used to be very slow. My impression is that it has been
> replaced internally by its SQL equivalent (which was a lot faster) since
> both are now about as fast.
>
> Since the SQL command 'select DISTINCT count(*) as Total from
> MyTable.dbf' also returns the total number of rows (not taking into
> account the 'Distinct' clause), that might explain the bug in the
> rowset.count() method.
>
> Jean-Pierre Martel, editor
> The dBASE Developers Bulletin
> Blue Star dBASE Plus Core Concepts Graduate
| |
| Jean-Pierre Martel 2006-01-27, 8:24 pm |
| In article <I1AOCl3IGHA.1704@news-server>, justjohn@netscape.ca says...
>
> Is the Bulletin still active?
There will be a new issue of the dBulletin as soon as I'll have 5
articles to be published. Mine is ready: I need 4 other ones.
After having published nearly 150 articles since our beginning, there are
less untouched ground to be covered. Yet, there are a lot of new custom
classes probably overlooked in our Community that deserved to be featured
in an article in our magazine. So let's see what the future reserves to
our readers... ;-)
> Seems there is no way to ask you a question on your web page - no mailto:
My email address appears on the bottom-right corner of my site's home
page:
http://www.jpmartel.com
However, I prefer public discussions (i.e. in dBASE NGs) about dBASE-
related problems and solutions because any help provided publicly is
useful to more people.
Jean-Pierre Martel, editor
The dBASE Developers Bulletin
Blue Star dBASE Plus Core Concepts Graduate
| |
|
| "However, I prefer public discussions "
Jean-Pierre Martel,
I have gone over everything you have published, and it would make a great
book. Guess all the authors would want a piece of the pie. The added .zip
files with the code is a great way to look at a process and then learn from
it. The code doesn't go off in left field or right, it stays on course.
I have also read all of the duflp but it never gives me the insight that I
get when I go to the dbulletin. I think it is because when they write to
the dbulletin they look at the bigger picture and explain things that way.
I know I pee... some people off; talking about the duflp; but I am
interested in how things work, not how someone thinks it should work and
then put their name to it as if they own it.
So you need 4 other dBulletins, well I might have a few. The one I am
currently working with, just blows me away. I've been programming for
almost 20 years, but this .CC does it all. I have a full feature program
that defines all my grids but does not input hundreds of lines of code in to
a single forms, this was a pain, you are doing the same thing over and over.
It is so simple to do, but I have never seem anyone write about it, lots of
"this and that" stuff but no one put it together. But I saw this reading
the dBulletins and continued with it. I can't thank you enough.
Your readers should unzip all the files that come with each release and have
a good look.
If you don't hear this often enough, then you should hear it everyday
starting with today - THANK YOU
John
P.S. it has been almost a year since the last bulletin - hope things move
more quickly.
"Jean-Pierre Martel" <nospam@nospam.com> wrote in message
news:MPG. 1e449549f7c4a3729897
8d@news.dbase.com...
> In article <I1AOCl3IGHA.1704@news-server>, justjohn@netscape.ca says...
>
> There will be a new issue of the dBulletin as soon as I'll have 5
> articles to be published. Mine is ready: I need 4 other ones.
>
> After having published nearly 150 articles since our beginning, there are
> less untouched ground to be covered. Yet, there are a lot of new custom
> classes probably overlooked in our Community that deserved to be featured
> in an article in our magazine. So let's see what the future reserves to
> our readers... ;-)
>
mailto:[color=darkre
d]
>
> My email address appears on the bottom-right corner of my site's home
> page:
> http://www.jpmartel.com
>
> However, I prefer public discussions (i.e. in dBASE NGs) about dBASE-
> related problems and solutions because any help provided publicly is
> useful to more people.
>
> Jean-Pierre Martel, editor
> The dBASE Developers Bulletin
> Blue Star dBASE Plus Core Concepts Graduate
| |
| Jean-Pierre Martel 2006-01-29, 11:23 am |
| In article <PcljtEOJGHA.1984@news-server>, justjohn@netscape.ca says...
>
> The added .zip files with the code (in the dBulletin) is
> a great way to look at a process and then learn from
> it. The code doesn't go off in left field or right, it
> stays on course.
Yes. I agree. Very often, a practical example is invaluable to understand
a theoretical discussion.
> I have also read all of the duflp but it never gives me
> the insight that I get when I go to the dBulletin.
The dUFLP is an extraordinary treasure chest. Ken has carefully collected
over the years, most of the brilliant pieces of code ever published in
the dBASE community. Beside Ken himself, probably that nobody knows the
huge amount of time needed to setup and to update such a wide collection.
A few years ago, I wanted to connect Ken's dUFLP to our index.
Unfortunately, that's a big undertaking since it means making a short
descriptive HTML page (with the appropriate link) for each piece of code
in the dUFLP. That's why I never did it.
> So you need 4 other dBulletins, well I might have a few.
Great! Be my guess... :-)
One of the nice things about an electronic magazine like ours is that our
articles are still consulted by people years after they were written. For
_printed_ magazines, most articles stop being consulted and being useful
when the issue is removed from the shelves of the magazine stand.
Over the weekend, I have browsed through Jamie Grant's web site and I saw
that he is rightly proud of the articles he wrote for the dBulletin. I
think that all our authors are happy that they were able to take the time
to sit down and write something useful that stays and lives years after
years.
> If you don't hear this often enough, then you should hear
> it everyday starting with today - THANK YOU
You're welcome. But honestly, the merit goes to our authors; they are the
ones who benevolently share their expertise and often their best secrets
with all of us.
> it has been almost a year since the last bulletin - hope things move
> more quickly.
I have posted a call to authors over a month ago: I'll be glad to publish
a new issue as soon as I'll have received the four other articles that I
need. <g>
Jean-Pierre Martel, editor
The dBASE Developers Bulletin
Blue Star dBASE Plus Core Concepts Graduate
| |
|
| > You're welcome. But honestly, the merit goes to our authors; they are the
> ones who benevolently share their expertise and often their best secrets
> with all of us.
I didn't mean to take away from any of the authors; I see their work in
other places. It just seems to be more understandable when they put it into
the dBulletin. Maybe the criteria set forth by the dBulletin is more to the
point.
I never wanted to take away from what Ken M. has done.
I just feel there is so much their; that it could of been put together
better. You have to remember for the first three years on the new dBase 7.01
and then the follow-ups we had nothing. It took them a few years to be
able to produce code that actually worked and only with the new releases.
We went through hell. All is forgiven, but our memories are still their.
There you go; I shot myself in the foot again.
Thanks John
"Jean-Pierre Martel" <nospam@nospam.com> wrote in message
news:MPG. 1e46b17f2c74ae1d9897
98@news.dbase.com...
> In article <PcljtEOJGHA.1984@news-server>, justjohn@netscape.ca says...
>
> Yes. I agree. Very often, a practical example is invaluable to understand
> a theoretical discussion.
>
>
> The dUFLP is an extraordinary treasure chest. Ken has carefully collected
> over the years, most of the brilliant pieces of code ever published in
> the dBASE community. Beside Ken himself, probably that nobody knows the
> huge amount of time needed to setup and to update such a wide collection.
>
> A few years ago, I wanted to connect Ken's dUFLP to our index.
> Unfortunately, that's a big undertaking since it means making a short
> descriptive HTML page (with the appropriate link) for each piece of code
> in the dUFLP. That's why I never did it.
>
>
> Great! Be my guess... :-)
>
> One of the nice things about an electronic magazine like ours is that our
> articles are still consulted by people years after they were written. For
> _printed_ magazines, most articles stop being consulted and being useful
> when the issue is removed from the shelves of the magazine stand.
>
> Over the weekend, I have browsed through Jamie Grant's web site and I saw
> that he is rightly proud of the articles he wrote for the dBulletin. I
> think that all our authors are happy that they were able to take the time
> to sit down and write something useful that stays and lives years after
> years.
>
>
> You're welcome. But honestly, the merit goes to our authors; they are the
> ones who benevolently share their expertise and often their best secrets
> with all of us.
>
>
> I have posted a call to authors over a month ago: I'll be glad to publish
> a new issue as soon as I'll have received the four other articles that I
> need. <g>
>
> Jean-Pierre Martel, editor
> The dBASE Developers Bulletin
> Blue Star dBASE Plus Core Concepts Graduate
| |
| Jean-Pierre Martel 2006-02-02, 8:24 pm |
| In article <tUEqOTDKGHA.1100@news-server>, justjohn@netscape.ca says...
>
> It just seems to be more understandable when they put it into
> the dBulletin.
When writing an article in our magazine, the author can take the time
needed to explain how things work.
> There you go; I shot myself in the foot again.
LOL !
Jean-Pierre Martel, editor
The dBASE Developers Bulletin
Blue Star dBASE Plus Core Concepts Graduate
|
|
|
|
|