Ahsan Amin


Is there any command/function that returns highest row no. from not deleted records Like if i have a table that contains 10 records from which 4 are deleted. Now i want it to return 6.



Re: Record No. in Not Deleted Records

hangover


There are various ways you can do this. One of the simplest (though not necessarily the quickest) would be to use the COUNT command, e.g.

COUNT ALL FOR NOT DELETED () TO pnHighestRowNo

(If you have issued SET DELETED ON then you can omit the 'FOR NOT DELETED ()' clause)

Dom







Re: Record No. in Not Deleted Records

Tamar E. Granor

Be aware that the number of non-deleted records is not the same as the record number (row number) of that last record that's not deleted. Naomi's solution tells you how many there are.

If you want to know the actual record number (though why you'd need that, I can't imagine), you need to do something like:

SELECT MAX(RECNO()) AS nRecNo;
FROM YourTable ;
WHERE NOT DELETED() ;
INTO CURSOR LastRec


Then LastRec.nRecNo contains the record number of the last non-deleted record.

Be aware, also, that the code above only works for looking at a single table. If you add any other tables to the query, it will break.

Tamar





Re: Record No. in Not Deleted Records

Naomi Nosonovsky

Hmm, I guess I'm hanging here so long what even in the threads I don't participate (was not too quck to jump in) my shadow is still there Smile I think it was hangover who provided a solution in this thread.





Re: Record No. in Not Deleted Records

Tamar E. Granor

Sorry about that. Not sure why I thought it was you.

Tamar