Serial number with prefix

I have looked through the help, video tutorials and checked with LLM, but I am stuck.
I can create a field with a serial number. However, I want to add a prefix to he serial number e.g. ad1, ad2, ad3 etc,
In the ‘formula’ of the field I have added “ad” + str(RecordNumber). However, I am not getting the prefix with the serial number.

Appreciate any guidance.

Thank you

What field?

str(RecordNumber)

Is RecordNumber a field you have created?

Do you want to wind up with two fields, one for named SerialNumber and one named RecordNumber? If so, the formula you have created will work, but the serial number will only be created when you edit the RecordNumber. If you want to recalculate the SerialNumber for every record, you would need to use the Field>Morph>Recalculate Field command

If you wanted to automate this with a procedure, the code would look like this:

field SerialNumber
formulafill "ad"+str(RecordNumber)

Or, if you set up the formula for the SerialNumber field, you could use this code:

field SerialNumber
recalculatefield

Thank you!

The field name is ‘’. Every time a new record is created I would like the new record to have ‘admissionID’ advanced by 1 and have a prefix “ad_” e.g. ad_1, ad_2, ad_3 etc

I use uniqueid( in the .NewRecord procedure to do exactly that.

This should have been your original post.

What you probably want to do is create a .NewRecord procedure.

You don’t actually need a RecordNumber field. Instead, you can use Panorama’s built in automatic numbering system. If you put the code below into the .NewRecord procedure it will automatically generate the admissionID for you (I’m assuming your field name is admissionID).

if info("trigger") = "New.Add"
    addrecord
elseif info("trigger") = "New.Insert"
    insertrecord
elseif info("trigger") = "New.Return"
    insertbelow
endif
admissionID = "ad"+str(getautonumber())

The sequence generated will automatically start with 1, but if you ever need to reset the sequence to start or restart at a different number you can do that using the Database Options dialog.

Thank you! I will study the link on uniqueid!

Thank you very much!
I implemented to guidance it worked nicely!
This is my first relational database in Panorama. The workflow and the round-trip is very efficient!