Jump to content
ABDug

FireDAC TFDTable navigation only sees the first 100 rows

Recommended Posts

If I connect a TFDTable to a MariaDB table containing 2000 rows, and immediately call FindLast(), I get back True for success, but it positions on the 100th row of the table, not the 2000th.

FDTable1.Open();
B:=FDTable1.FindLast();
Memo1.Lines.Add(Format('Return=%s A=%d', [NameFromBoolean(B), FDTable1A.AsInteger]));
FDTable1.Close();

I'm running Delphi XE10.2. I've dug through the FireDAC source code and found it is applying LIMIT 100 to the initial select query to populate the TFDTable, but I'm not understanding why the FindLast runs in that initial query result rather than the whole table.

Is there any workaround for this? Thanks.

Share this post


Link to post

Maybe read the help (you should use Last):

FindLast is intended to be used together with FindPrior, FindFirst and FindNext in order to search for the last record using any filters. See the example.

Notes:

Descendant classes override FindLast to make the last record active, honoring any filters that are in effect. In descendants, FindLast returns true:

  • True -- if the active record is successfully changed.
  • False -- if the active record is not successfully changed.

Share this post


Link to post

Thank you, that worked.

I'm moving a significant amount of code from another set of data access components to FireDAC. In the previous components, FindLast and Last did the same thing. We were in the habit of using the Find__ versions because they return a success/failure flag.

Thanks again, I can work with this.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×