Automate catalog number with custom start

I would like to set up automatic catalog number incrementation in the form “ZMB_Mam_######”, but starting with a certain number such as “135500” rather than “000001.”
The collection already contains numerous computerized specimens with catalog numbers preceding “135500,” but not the entire series. It should therefore also be possible to enter the catalog number “ZMB_Mam_44” if it has not yet been computerized.

For now, I have created the format field in (UIFormatters) app resource as follows (I don’t know how to start from a certain number):

 <format system="false" name="Mammals_AutoNumbering_CatalogNumber" class="edu.ku.brc.specify.datamodel.CollectionObject" fieldname="catalogNumber">
   <autonumber>edu.ku.brc.specify.dbsupport.AccessionAutoNumberAlphaNum</autonumber>
  <!-- Create a catalog number in the form ZMB_Mam_XXXXX -->
    <field type="constant" size="8" value="ZMB_Mam_" />
    <field type="numeric" size="6" inc="true" />
  </format>

In the configuration schema, I have selected the required format.#

I then modified the XML code in the form schema.

			<cell type="label" labelfor="CatalogNumber"/>
			<cell type="field" id="CatalogNumber" name="catalogNumber" uitype="formattedtext" isrequired="true" default="ZMB_Mam_######" colspan="4"/>

Unfortunately, it doesn’t work. When I create a new entry, it doesn’t automatically generate an incrementing catalog number, but only “ZMB_Mam_######.”

I don’t fully understand all the steps involved in achieving what I want. Can you help me? Thank you very much in advance.

Hi @Marion,

Thanks for your question!

The format you’ve defined looks good to me.

For your first point, if you want ZMB_Mam_###### to start at a certain number (e.g. ZMB_Mam_135500), you can simply create a Collection Object with that number and all subsequent records entered will increment based on that value.

The next record you create with auto-incrementing on will be ZMB_Mam_135501.

If you want to fill in previous numbers (e.g., ZMB_Mam_000044), you can enter them manually using forms-based data entry or WorkBench, or you can assign them in bulk through Batch Edit.

The reason you are not seeing the auto-incrementing behavior work is because setting the Catalog Number is a little different than simply setting the field format in Schema Config. It needs to be set both there and in the Collection record.

See How to Change the Catalog Number Format:

This means you need to edit the Collection record for Mammals (in your database):

This just needs to be changed from CatalogNumberString to Mammals_AutoNumbering_CatalogNumber. Once this is done, you can save the updated Collection record.

Now when you save a new record, auto-incrementing should take place right away! If you would like me to do this for you in your database, just let me know.


In response to your question, I’ve added a new section in the Field Formatting and Auto-Numbering documentation to better cover this behavior as well.

Incrementing Behavior

When you have a numeric incrementing field segment (like ABC-####), it automatically identifies the highest value and adds 1 to it.

For example, consider the following three records in the Accession table:

Accession Number
ABC-0001
ABC-0003
ABC-0301
ABC-0502

When you create a new Accession Number, either through the data entry forms or via the WorkBench using the auto-incrementing functionality (e.g., leaving the field as ABC-###), it generates the number ABC-0503.

Accession Number
ABC-0001
ABC-0003
ABC-0301
ABC-0502
ABC-0503

Specify does not fill in the gaps between numbers automatically. Those values will need to be entered manually via WorkBench or Batch Edit, or filled in using Bulk Carry Forward.

Thank you Grant for your help.

Now it works fine, but there is still a small problem that I would like to resolve.
Is it possible to authorise the creation of old catalogue numbers, but not with 6 digits? The old catalogue numbers that should be used without auto numbering are for example in the form ‘ZMB_Mam_44’ and not ‘ZMB_Mam_000044’.
What should I do in the format field code?

Hi @Marion,

Using a standard field format, this is not currently possible.

Effectively, the field format requires a 6-digit value, which means ZMB_Mam_###### will be the format it validates against. It requires the padded leading zeros to consider it a valid format.

You could alternatively use a regular expression as a field format instead by following this guide which would allow you to add both ZMB_Mam_44 and ZMB_Mam_135500 as values, but in that case, auto-incrementation would not be available.

The expression would look something like this:

^ZMB_Mam_\d{1,6}$
  • ^ indicates the start of string
  • ZMB_Mam_ this is the static prefix
  • \d{1,6} allows for between 1 and 6 digits
  • $ terminates the string

You can use the “Alternate Catalog Number” field (altCatalogNumber) in the Collection Object table to capture the original number so that historical numbers are still available but do not prevent older records from being saved as each time a record is modified, it re-validates against the current format.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.