Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 8 of 8 total |
How to tell if you are on the last row |
Sat, May 6 2006 3:37 AM | Permanent Link |
"Clive" | How do you tell if you are at the very last record in a Result set ?
I know you can test qry.EOF but this is only set to true when you try and navigate to the next row after you have been on the last row. I tried using recno = recordcount but recno I think had values from the underlying table not from the query so this didnt work. What I have done is go qry.NEXT, then test for EOF, then go back 1 row if not EOF .. But this is slow. Thanks Clive. |
Sat, May 6 2006 5:14 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Clive
If you're doing this in a loop then outside the loop do a .Last, get the key fields and then compare those. Roy Lambert |
Sat, May 6 2006 5:47 AM | Permanent Link |
"Clive" | Thats basically the same princple as going next at the end and testing for
EOF. I just wanted to avoid having to do this as I do it many times and it feels and is inefficient. Cheers Clive "Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message news:D744E5FA-E780-4557-BD13-470BFFA6641E@news.elevatesoft.com... > Clive > > > If you're doing this in a loop then outside the loop do a .Last, get the > key fields and then compare those. > > Roy Lambert > |
Sat, May 6 2006 6:26 AM | Permanent Link |
"GregF" | "Clive" <dd@dddd.com> wrote in message news:052F1703-FC10-4433-A3C3-DD19D6F9427E@news.elevatesoft.com... > How do you tell if you are at the very last record in a Result set ? > > I know you can test qry.EOF but this is only set to true when you try and navigate to the next row after you have been on the last > row. > > I tried using recno = recordcount but recno I think had values from the underlying table not from the query so this didnt work. > > What I have done is go qry.NEXT, then test for EOF, then go back 1 row if not EOF .. But this is slow. > > Thanks > Clive. > Basically there is no way to avoid any variation on the same theme query.First while not query.Eof do begin [imperatives] [query.next] end; query.last; gregF |
Sat, May 6 2006 1:22 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Clive
If you're doing it in a loop you are using 2xrecordcount (next & prior) record moves plus 1xrecordcount test (eof) my version would do 2 additional record moves (last & first) and (if its a single field primary key) 1xrecordcount test. Unless my arithmetic is way off my version should be more efficient. Roy Lambert |
Sat, May 6 2006 6:35 PM | Permanent Link |
"Clive" | You are correct, It will be faster to take note of the last recno and
check for this... Thanks Clive,. "Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message news:27874A3E-1A00-42C2-9CA6-B58D6ABCDC1D@news.elevatesoft.com... > Clive > > > If you're doing it in a loop you are using 2xrecordcount (next & prior) > record moves plus 1xrecordcount test (eof) my version would do 2 > additional record moves (last & first) and (if its a single field primary > key) 1xrecordcount test. > > Unless my arithmetic is way off my version should be more efficient. > > Roy Lambert > |
Mon, May 8 2006 2:55 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Clive,
<< How do you tell if you are at the very last record in a Result set ? >> Is this a live result set or canned result set ? If canned, just check for RecNo=RecordCount. -- Tim Young Elevate Software www.elevatesoft.com |
Mon, May 8 2006 4:51 PM | Permanent Link |
"Clive" | Sometimes Canned, Sometime Live, Its a generic procedure.
When I was trying it Recno had values from the underlying tables so must have been live. Roys suggestion works fine more me now. Cheers Clive. "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message news:0970309F-7210-4F06-92D8-FE8918A6125C@news.elevatesoft.com... > Clive, > > << How do you tell if you are at the very last record in a Result set ? >> > > Is this a live result set or canned result set ? If canned, just check > for RecNo=RecordCount. > > -- > Tim Young > Elevate Software > www.elevatesoft.com > > |
This web page was last updated on Wednesday, April 24, 2024 at 11:07 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |