Skip to main content

Ordinal number in a field

How can I makes sure that in database in IDEA when appending a new field each record will have ordinal number from top to bottom ( 1 to last record) - I thought there might be some function in IDEA to do it similar to ROW() in excel but wasnt able to identify it. I can build something with RecordSet I guess when I will loop from 1 to RecordSet.Count but I am sure there is an easier solution.
Apologies if it is a silly question.

Steven Luciani Wed, 10/17/2018 - 11:22

Hi bluecox,

After importing the file into IDEA you have two functions you can use to execute your task.

@RECNO() - no parameters needed will create a numeric field starting at 1 to the last record. Note that if you index the file the first record in your index becomes 1 even though it may have been the 77 record prior to the index.

If you want the number to remain with the record as it was originally imported no matter how you index the file you need to use the @PRECNO() function - again no parameters are required.

You can easily add either of these fields in your file by right clicking on the data and choosing append field from the pick list presented. Choose a virtual numeric or numeric field type and just type the equation as written in this post or enter the equation editor via the button with the calculator on it and go to the numeric subset in the function list and you will find both functions. Double click on the one you want to use to use it then click the green check mark to close the equation editor window. Then OK on you append field window.

Regards,

Steven