Setting Prefixes to Field Types

I’m trying to build a database and wish to set Alphanumeric prefixes in front of an auto generated sequential number. Is this possible in LibreOffice base?

Hello,

The answer to your question is Yes… and NO.

You can only set an INTEGER or BIGINT (default HSQLDB) to an AutoValue which automatically becomes a part of the Primary KEY. This cannot be modified. You can also set another field (your prefix) to be another part of the primary key. Therefore, the primary key would actually consist of two fields. However, the AutoValue will increment with every record added and not for each prefix you have. Probably not what you are looking for.

The other way would be to create the key via a macro, but macro experience is necessary. You would need to have a routine to look up the last value created and increment that to be used as the key. Could get a bit messy.

If this answers your question please click on the :heavy_check_mark: (upper left area of answer).