ABDug 0 Posted November 4, 2020 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
Lajos Juhász 293 Posted November 4, 2020 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: This function is not implemented for TFDTable Live Data Windows mode. To conventionally navigate through a dataset use First, Last, Next and Prior. 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
ABDug 0 Posted November 4, 2020 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