Answered How to find if the record we are looking is the last or first

Hi Guys,

I'm working on a navigation pann through a table.
I have a "First button", "Prev button", "Next button" & "last button".
My question for the Next and Prev case .
I'm using "Find next myTableName no-lock no-error" & "Find prev myTableName no-lock no-error" .
I wanted to know if there an instruction that can help me to know if the record is the last or the first?

Thank you in advance as always,

Best regards,

- BobyIsProgress -
 
Last edited:

TomBascom

Curmudgeon
In this sort of scenario you just go ahead and FIND NEXT ... NO-ERROR. If nothing is available you were on the last record (or the first if you were doing FIND PREV...) If you do it again then you "wrap around" to the FIRST. If you want you could do an invisible wrap-around by just doing a 2nd FIND NEXT if your normal FIND NEXT finds nothing.
 
Hi @TomBascom

Thank you for your advice I will go for it.

@Leandro I was doing it by storing at running time the rowid of the first record and the rowid of the last to make comparison. But it needs to be updated if create or delete records.

Thank you all,

- BobyIsProgress -
 
Top