bBrowser row count for specific condition

67 views
Skip to first unread message

Grzegorz R.

unread,
May 6, 2021, 4:54:12 PMMay 6
to
Hello all,
I have child DBserver filtered with SetSelectiveRelation and bound to bBrowser.
I would like to quicklu get count of all recs where one column (field) is not empty. Like CheckColumn:CheckedCount bot not logical column/field - in this case it's date field.
I could do it with while-skip loop (either at DBserver or bBrowser) but I'm afraid it will be slow and I think that lowlevel :CheckedCount is much faster and does not require moving bound server.
I have created virtual column containing logical value (empty/not empty) but Virtualcolumn does not have :CheckedCount method even if contains logical values.
I could also add new field to database with logical flag empty/notempty and bind CheckColumn but it just would in some way "duplicate" info that is already in DB (although in another form).
Is there any way to count rows that meet a certain coniditon in specific column without moving dbserver pointer?
Kind regards
Gregory

dlzc

unread,
May 7, 2021, 9:44:43 AMMay 7
to
Dear ramo...:

On Thursday, May 6, 2021 at 1:54:12 PM UTC-7, ramo...@gmail.com wrote:
...
> Is there any way to count rows that meet a certain coniditon
> in specific column without moving dbserver pointer?

Can you create an index on that date field, set ".not. empty()" as one of the conditions, and get a count of indexed items? If it is a "permanent" index, then you should have less performance penalty.

I don't do VO, so I cannot help beyond that. Something like:
https://harbour.github.io/doc/rddads.html#adskeycount

David A. Smith

Grzegorz R.

unread,
May 10, 2021, 8:39:55 AMMay 10
to
Hello David

thank You for suggestion but a) I can make index FOR (condition) but it does not tell how many elements have been indexed (at least I do not know how to get it) and b) I do not use Harbour ADS so do not have any advanced functions&methods.

Anyway - thank You
Gregory

dlzc

unread,
May 10, 2021, 10:08:45 AMMay 10
to
Dear ramo...:

On Monday, May 10, 2021 at 5:39:55 AM UTC-7, ramo...@gmail.com wrote:
> piątek, 7 maja 2021 o 15:44:43 UTC+2 dlzc napisał(a):
> > On Thursday, May 6, 2021 at 1:54:12 PM UTC-7, ramo...@gmail.com wrote:
> > ...
> > > Is there any way to count rows that meet a certain coniditon
> > > in specific column without moving dbserver pointer?
> > Can you create an index on that date field, set ".not. empty()"
> > as one of the conditions, and get a count of indexed items?
> > If it is a "permanent" index, then you should have less
> > performance penalty.
> >
> > I don't do VO, so I cannot help beyond that. Something like:
> > https://harbour.github.io/doc/rddads.html#adskeycount
>
> thank You for suggestion but a) I can make index FOR
> (condition) but it does not tell how many elements have
> been indexed (at least I do not know how to get it)

That was my hope, that VO had tools similar to those for ADS (not a part of (x)Harbour... a sort of SQL alternative).

The type of index used, the number of keys is stored in the index file:
https://www.clicketyclick.dk/databases/xbase/format/cdx.html#CDX_STRUCT
... not saying you use CDX files.

> and b) I do not use Harbour ADS so do not have any
> advanced functions&methods.

I was not trying to convert you. Just trying to get you 'out of the corner'. I hope someone chimes in with a way to accomplish your need. I'll shut up now.

David A. Smith
Reply all
Reply to author
Forward
0 new messages