Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 11 total
Thread DBISAM 3.X TO 4.X Recno value does not respect filter
Wed, Jul 9 2008 11:50 PMPermanent Link

Steve Baker
I upgraded to 4.26 Build 3  from 3.x and now have a problem with recno on a filtered table.  I see a similar post from 2005 below, but no solution.
http://www.elevatesoft.com/newsgrp?action=searchopenmsg&group=5&msg=53213&keywords=recno* filter*#msg53213

In a simple client side database application:
A TDbisamTable is filtered with the following code:
          dm.PdsHelp.Filter := 'tag=''' + cTag + '''';
          dm.PdsHelp.FilterOptions:=[foCaseInsensitive, foNoPartialCompare];
          dm.PdsHelp.Filtered:=True;

The filter works fine, and lets say 5 records are in the filter set.  
The filterrecordcounts property is set to true in the TDbisamEngine, and the table.recordcount correctly returns 5

The problem is that recno does not respect the logical record number value within the filtered record set.  It should return values of 1...5 based on which record is current
within the filtered records.  It does not though.  It indicates the physical record number in the entire table, and not the logical record number of the filtered record set.

I use it to display a page number within a filtered record set, and the display should be  "1/5 or  "2/5" or "3/5" or "4/5" or "5/5"
It's not though...    I get 19/5  or 45/5     etc....    recno is returning the physical whole table record number
I set the display with this code:

 frmEditor.SetPageNum(dm.PdsHelp.Recno,dm.PdsHelp.RecordCount);

Version 3.x had no problem with this.  I looked for a new FilteredRecno property or something but see nothing.  Can someone tell me how to get recno to correctly reflect the
filtered recno?  Thanks
Thu, Jul 10 2008 10:46 AMPermanent Link

Pat
>I looked for a new FilteredRecno property or something but see nothing.

what about  MyTable.FilterRecordCount ?

Pat
Thu, Jul 10 2008 2:51 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Steve,

<< The filter works fine, and lets say 5 records are in the filter set.
The filterrecordcounts property is set to true in the TDbisamEngine, and
the table.recordcount correctly returns 5

The problem is that recno does not respect the logical record number value
within the filtered record set.  It should return values of 1...5 based on
which record is current within the filtered records.  It does not though.
It indicates the physical record number in the entire table, and not the
logical record number of the filtered record set. >>

I think you're mistaken here.  3.x never displayed an accurate record number
for a filtered set.  That was the whole reason behind the FilterRecordCounts
property.  It allows you to say that you want the entire record count to be
used so that grids display an accurate scrollbar on a filtered dataset.

The rule is this;

FilterRecordCounts = True  -> RecordCount returns total number of records,
and FilterRecordCount returns filtered count

FilterRecordCounts = False -> RecordCount returns filtered record count

Neither of these change the record number, which is always a sequence number
based upon the total number of records in the dataset.  This is exactly the
same with 3.x.  In fact, in the 3.x DBSYS we simply don't show record
numbers for filtered datasets due to the fact that they show like this with
a filter:

Record 13 of 2

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Jul 10 2008 2:55 PMPermanent Link

Steve Baker
>>
what about  MyTable.FilterRecordCount ?
<<

Hi Pat,
That would give me the number of filtered records, but not the relative recno of the current record.

I need Recno of the current record to return the ordinal value of the record within the filtered records.   That's the way it always has been before.

Thanks  /steve
Thu, Jul 10 2008 3:53 PMPermanent Link

Steve Baker
Hi Tim,

>>
I think you're mistaken here.  3.x never displayed an accurate record number
for a filtered set.  
<<

Well OK...  I'll do some testing, but...  We have an application installed on thousands of machines, using Dbisam 3.27.  Our entire context sensitive help system for the
program is built upon TDbisamTable.Recno returning the ordinal position of the record within the filtered records. I'm pretty sure it works as stated but maybe I am
overlooking something so I'll dig deeper and see what I find.

>>
The rule is this;
FilterRecordCounts = True  -> RecordCount returns total number of records, and FilterRecordCount returns filtered count
FilterRecordCounts = False -> RecordCount returns filtered record count
<<

Did you flip those around?  I thought it was the opposite case from reading the docs.

>>
Neither of these change the record number, which is always a sequence number
based upon the total number of records in the dataset.  
<<

OK then, using Dbisam, how can I obtain the ordinal position of a record within a filtered group of records so I can get my 1/5, 2/5   etc   ?

Thanks  /steve
Thu, Jul 10 2008 4:20 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Steve,

<< Did you flip those around?  I thought it was the opposite case from
reading the docs. >>

Nope.  You can see this behavior in the 4.x DBSYS - it uses
FilterRecordCounts = False.

<< OK then, using Dbisam, how can I obtain the ordinal position of a record
within a filtered group of records so I can get my 1/5, 2/5   etc   ? >>

You can't, nor have you ever been able to (at least not through DBISAM).
Perhaps you're thinking of ranges ?  Ranges can return an ordinal position
in a range.

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Jul 11 2008 8:15 AMPermanent Link

Steve Baker
Hi Tim,

Regarding FilterRecordCounts, this is what the docs say, which seems to be the opposite of the way you explained it to me?

"The default value of this property is True, which means the RecordCount property of the TDBISAMTable and TDBISAMQuery components will always take into account any
active filters..."

"If the FilterRecordCounts property is set to False, the RecordCount property of the TDBISAMTable and TDBISAMQuery components will always show the total record count of
the entire dataset..."

>>>>
<< OK then, using Dbisam, how can I obtain the ordinal position of a record
within a filtered group of records so I can get my 1/5, 2/5   etc   ? >>

You can't, nor have you ever been able to (at least not through DBISAM).
Perhaps you're thinking of ranges ?  Ranges can return an ordinal position
in a range.
<<<<

Sorry, but I don't agree with you.  I looked into this further and built a simple test app using both 3.27 and 4.26 and using the same code.  I'll upload the EXEs to you along
with the code.  You can run the two programs side by side and clearly see that version 3 RECNO returns the ordinal position of a record within a filtered group of records, and
version 4 does not.  I also think from reading this newsgroup, that this fact was identified in 2005 when another user wrote almost an identical message after upgrading to
version 4.  This incompatibility breaks our help system, and you offer no solution.   How about if we used a Query?   I've read some other messages on here that indicate that
might do it for us.  My concern though is that we write and edit specific context-specific help right within our programs, which means we would need to append and edit the
result set...  From what I read, we couldn't do this with a Live query?

Thanks
/steve
File Uploaded:  dbisam3vs4.zip



Attachments: dbisam3vs4.zip
Fri, Jul 11 2008 12:23 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Steve,

Please don't post large attachments in this newsgroup.  That is what the
Binaries newsgroup is for.

<< Regarding FilterRecordCounts, this is what the docs say, which seems to
be the opposite of the way you explained it to me? >>

Sorry, yes, I flipped them around in my example - the docs are correct.

<< Sorry, but I don't agree with you.  I looked into this further and built
a simple test app using both 3.27 and 4.26 and using the same code.  I'll
upload the EXEs to you along with the code.  You can run the two programs
side by side and clearly see that version 3 RECNO returns the ordinal
position of a record within a filtered group of records, and version 4 does
not. >>

3.x had one exception to the RecNo sequencing, and that was a table with no
primary index defined on it, which is exactly the type of table that you're
using with your example.  4.x doesn't allow such a table without a primary
index, so that exception was removed.

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Jul 11 2008 1:36 PMPermanent Link

Steve Baker
Tim,

>>>
Please don't post large attachments in this newsgroup.  That is what the
Binaries newsgroup is for.
<<<

Sorry, didn't know.


>>>>
3.x had one exception to the RecNo sequencing, and that was a table with no
primary index defined on it,
<<<<

That explains it then.  Thanks for looking into this.  At least I know where we stand, and can make a decision from here.

/steve
Fri, Jul 11 2008 5:33 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Steve,

<< That explains it then.  Thanks for looking into this.  At least I know
where we stand, and can make a decision from here. >>

You'll have to excuse my seemingly clueless responses about 3.x at times.
It's just been so long since I've messed around with the 3.x code base, that
isn't very fresh in my mind.  With all of these versions of products running
around, the old ones get pushed out in my head to make room for the new
ones.  We just release EDB 2.01, so that means that I probably just forgot
some more things about DBISAM 2.12. Smiley

BTW, your best workaround in this situation, especially with small numbers
of rows, is to just count the rows and calculate the sequence numbers.  If
the datasets are larger, however, it might be more feasible to generate a
canned result set with a query (just a SELECT * FROM MyTable WHERE
<Condition> with the TDBISAMQuery.RequestLive property set to False).  That
will give you a filtered set that always has the correct sequential record
numbers.

--
Tim Young
Elevate Software
www.elevatesoft.com

Page 1 of 2Next Page »
Jump to Page:  1 2
Image