Naren17 - this might be a simpler approach. But first, you must understand what you are asking; or, I need to.
It sounds like you are asking for the “number” of the record you are looking at - out of the group of records you selected.
That implies the records are in some order - the 12th record is different from the 11th and the 13th. That order/position depends on how the records are sorted.
See how all this has to be thought out BEFORE you consider how to do it.
Here is a very simple way … Create a numeric integer field in your database called RecNum (it could be any name). Add the field to your form.
After your procedure (or manual action) that does the selection and possible sorting, you now have your candidate records in the desired order.
I’ll tell you what to do because I don’t know if you’ll be writing a procedure or doing the steps manually. PanX has a feature that will “record” your steps and write most of the procedure for you - but that’s a different topic.
Click in any RecNum field record
Under the menu Field hold the mouse on Morph and slide over to select “Fill with Formula”
Note - you can also right-click on the field name RecNum and reach Morph/Fill with Forumula from there.
In the Formula window put Seq() and click the “Fill” button
This will put an ascending sequence number in the RecNum field of each selected record.
If you now view those records, individually, on a form and the form has the field RecNum on it, you’ll see if you are looking at the first, second, third, etc. record of the ones you’ve selected (and maybe sorted).
But, as the Charmin commercials might say, “… the job’s not over until the paperwork is done.”
Once done with whatever task you are doing, you’ll want to “clean out” RecNum so it’s ready for the next time.
Make sure you are in the RecNum field
Go to “Fill with Formula” again (via Morph)
In the Formula box put “”
That’s two quotes with nothing between them.
Click the Fill button.
That will clean out (empty out) the RecNum field.
A simple procedure code for that is:
Field RecNum
FormulaFill “”
Note that it will only act on selected records.
Where and when you do that is up to your proclivities.
I don’t assume the condition of a database when I open it. In my initialize routine I put the database in a “known” condition by selecting/sorting to some state. For example, I might do
SelectAll
Field RecNum
Formulafill “”
RecNum is now cleared for all records.
If you don’t clear RecNum when you are finished with the task at hand, there’s a risk that you might view a record that has a remnant of your Seq() action remaining in RecNum and you’ll see a record number that is not representative of the current condition.