Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 10 total
Thread RecordCount don't work with onFilterRecord
Mon, Sep 29 2008 10:34 AMPermanent Link

"Mauro Botta"
Hi

I have a table with 5 record
ID
1
2
3
4
5
check :
edbxTable1.RecordCount = 5 , OK ^^

add :
edbxTable1.Filter := ID > 2
edbxTable1.Filtered := True
check :
edbxTable1.RecordCount = 3 , OK ^^

add :
procedure TForm1.edbxTable1FilterRecord(DataSet: TDataSet;
 var Accept: Boolean);
begin
Accept := Dataset.fieldByName('ID').AsInteger = 5;
end;


check :
edbxTable1.RecordCount = 3 !!!
it is wrong.
correct is : 1


RecordCount  examine only the string FILTER property and not OnFieldRecord
function.


Mon, Sep 29 2008 11:03 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Mauro


Correct, its a consequence of Tim making the OnFilterRecord MUCH faster. Wherever possible I'd recommend just using filter rather than OnFilterRecord.

Roy Lambert [Team Elevate]
Mon, Sep 29 2008 11:24 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mauro,

<< RecordCount  examine only the string FILTER property and not
OnFieldRecord function. >>

Yes, this is correct.  OnFilterRecord is now a client-side operation that
does not take into account anything except filtering rows at the client.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Sep 29 2008 11:26 AMPermanent Link

"Mauro Botta"
> Correct, its a consequence of Tim making the OnFilterRecord MUCH faster.
> Wherever possible I'd recommend just using filter rather than
> OnFilterRecord.
>
> Roy Lambert [Team Elevate]

in real world the OnFilterRecord don't have alternative.

but.... Is there a fix ? in 2.02 is Fixed ?
Mon, Sep 29 2008 11:31 AMPermanent Link

"Mauro Botta"
> Yes, this is correct.  OnFilterRecord is now a client-side operation that
> does not take into account anything except filtering rows at the client.

*.*

I do not agree on this implementation.

in FishDemo table.Filter work well
but in the real world OnFilterRecord don't have alternative.

Is possibile have a property of edbEngine for have recordcount with
OnFilterRecord ( 2.03 ) ?


Mon, Sep 29 2008 12:03 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Mauro


Can you give some examples of where it doesn't work?

Roy Lambert [Team Elevate]
Mon, Sep 29 2008 12:12 PMPermanent Link

"Mauro Botta"
> Can you give some examples of where it doesn't work?

Notthing code.

i need table.recordcount work ON onfilterecord, too.

Is there any workaround for to have it ?
Mon, Sep 29 2008 12:35 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mauro,

<< in FishDemo table.Filter work well but in the real world OnFilterRecord
don't have alternative. >>

Correct, which is why we improved it in EDB so that it did not require the
ElevateDB Server to constantly call back across the wire to the client
application in order to filter each row, and to only have the EDB engine on
the client side filter as many rows as required to satisfy the data-aware
controls.  In exchange for this, we had to remove the ability to have an
accurate record count with the OnFilterRecord event.

<< Is possibile have a property of edbEngine for have recordcount with
OnFilterRecord ( 2.03 ) ? >>

No, it is not possible.  You're simply going to have to understand that EDB
is not a one-to-one upgrade to DBISAM, but rather a completely different
product.  There are a *lot* of differences between the two.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Sep 29 2008 1:02 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Mauro


>Notthing code.

If you can provide some concrete examples we may be able to suggest some alternative approach

>i need table.recordcount work ON onfilterecord, too.

If you don't have any code how do you know?

>Is there any workaround for to have it ?

Possibly - it depends on what you're doing.

Roy Lambert [Team Elevate]
Mon, Sep 29 2008 4:36 PMPermanent Link

Ralf Graap
Hey Mauro,

if the OnFilterRecord-Event is only computed on the Client-Side,
why don't count the Records there:

function CountRecords(ds: TDataset): Integer;
var
  bm : Pointer;

begin
  Result := 0;

  bm := nil;

  ds.DisableControls;
  try
    bm := ds.GetBookmark;
    ds.First;
    while not ds.EoF do
    begin
      Inc(Result);
      ds.Next;
    end;
  finally
    if Assigned(bm) and ds.BookmarkValid(bm) then
    begin
      ds.GotoBookmark(bm);
      ds.FreeBookmark(bm);
    end;
    ds.EnableControls;
  end;
end;

I think that's okay for a few hundreds of records.

But I would prefer using some optimized SQL-Stmts or Filters Smile

Ralf


Mauro Botta schrieb:
>> Can you give some examples of where it doesn't work?
>
> Notthing code.
>
> i need table.recordcount work ON onfilterecord, too.
>
> Is there any workaround for to have it ?
>
Image