# Formatted catalog number in DwCA export

**URL:** <https://speciforum.org/t/formatted-catalog-number-in-dwca-export/2697>\
**Category:** Get Help\
**Created:** [July 9, 2025, 9:50am UTC](https://speciforum.org/t/formatted-catalog-number-in-dwca-export/2697 "2025-07-09T09:50:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZsPapp](https://avatars.discourse-cdn.com/v4/letter/z/977dab/32.png) [@ZsPapp](https://speciforum.org/u/ZsPapp)\
**Post date:** [July 9, 2025, 9:50am UTC](https://speciforum.org/t/formatted-catalog-number-in-dwca-export/2697/1 "2025-07-09T09:50:48Z")

</div>

We would like to include our institution acronym into our catalog number during DwCA export.  
If we follow the guides the exported catalog number is the numeric one: eg. 896415, which is our default catalog number format (CatalogNumberNumeric #########) without the leading zeros.

The corresponding part of the DwCA definition:

```auto
<field term="http://rs.tdwg.org/dwc/terms/catalogNumber"
stringId="1.collectionobject.catalogNumber" 
oper="1" value="" isNot="false" isRelFld="false"/>

```

We have a record formatter at collection level to add prefix to the catalog number.

```auto
<format name="CollectionObject" title="CollectionObject" class="edu.ku.brc.specify.datamodel.CollectionObject" default="true">
	<switch single="true">
		<fields>
			<field uifieldformatter="CatalogNumber" sep="NHMD">catalogNumber</field>
		</fields>
	</switch>
</format>

```

When I add the formatName=“CollectionObject” attribute to the DwCA definition, we experience no change in the export.

The only solution we found is to refer the catalog number from the determination table, like this:

```auto
<field term="http://rs.tdwg.org/dwc/terms/catalogNumber" 
stringId="1,9-determinations,1.collectionobject.collectionObject"  
value="" oper="1" isNot="false" isRelFld="true" />

```

This way we get NHMD896415, what we wanted.

What would be the preferred process to meet the same objective in a more elegant way?

Specify 7 Version: v7.9.6.2, also in v7.10.2.3

---

<div class="post-metadata">

**Author:** ![bhumikagupta](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@bhumikagupta](https://speciforum.org/u/bhumikagupta)\
**Post date:** [July 10, 2025, 8:15pm UTC](https://speciforum.org/t/formatted-catalog-number-in-dwca-export/2697/3 "2025-07-10T20:15:42Z")

</div>

Good Afternoon,

Thank you for bringing this to our attention! We are currently looking into the issue and finding possible explanations and solutions.

Thank you.

---

<div class="post-metadata">

**Author:** ![bhumikagupta](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@bhumikagupta](https://speciforum.org/u/bhumikagupta)\
**Post date:** [July 11, 2025, 3:51pm UTC](https://speciforum.org/t/formatted-catalog-number-in-dwca-export/2697/4 "2025-07-11T15:51:42Z")

</div>

Good afternoon,

Thanks for reaching out and for providing the details of your current setup and the workaround you’ve found!

You are right that referring to the catalog number from the determination table to add the “NHMD” prefix, while effective, isn’t the most scalable or recommended solution. It bypasses the intended mechanism for formatting these fields.

The preferred and more robust approach to achieve this is indeed by editing the table format directly within the Schema Configuration for the `CollectionObject` table. This allows you to define how the `catalogNumber` field should be presented universally across Specify, including in your DwCA exports.

First, in the [user tools](https://speciforum.org/t/user-tools-menu/536) go to the Schema Configuration and select collection object as your base table.

 ![user tools](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/4/473f3d7cf56939a9292d0e70533bc3f2fd326405.png)

 ![schema confiuration](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/d/d261d3b133d3884a524eeb0ece500b8cc503883c.png)

Then, click on the :pencil_: icon next to table format and add NHMD as a separator.

 ![table format: collection object](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/f/fd620abe486bfd20a18987c994f3cbac2a935e0d.jpeg)

You can change the formatting in this tab and immediately in the preview below see what the formatting would entail.

Thanks!

---

<div class="post-metadata">

**Author:** ![ZsPapp](https://avatars.discourse-cdn.com/v4/letter/z/977dab/32.png) [@ZsPapp](https://speciforum.org/u/ZsPapp)\
**Post date:** [July 15, 2025, 8:21am UTC](https://speciforum.org/t/formatted-catalog-number-in-dwca-export/2697/5 "2025-07-15T08:21:19Z")

</div>

Dear Bhumika,  
thank you for your reply!  
Unfortunately the approach you suggested doesn’t solve our problem. ☹  
Our table format is already has NHMD as a separator:

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/c/cf02da5c0e811be66284fda647fd3a64e4859a73.jpeg)

And still, in the DwCA export it is displayed without separator and leading zeros, like this: 1811696. (Expected: NHMD1811696)

Using the formatName attribute in the mapping file makes no difference:

```auto
                <field term="http://rs.tdwg.org/dwc/terms/catalogNumber" stringId="1.collectionobject.catalogNumber" oper="1" value="" isNot="false" isRelFld="false"  
         formatName="CollectionObject"/>
                <field 

```

Is it possible that it is determined on a higher level somewhere?

Thanks!

---

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [July 15, 2025, 5:33pm UTC](https://speciforum.org/t/formatted-catalog-number-in-dwca-export/2697/6 "2025-07-15T17:33:24Z")

</div>

Hi @ZsPapp,

Hi from Kansas! 😄 👋 🌾

I believe the issue here is that you are trying to apply a table format to a field (`collectionobject.catalogNumber`) rather than mapping to the (formatted) table field itself (`collectionobject.`).

I defined a table format as described by @bhumikagupta, and once I did so, I was able to map the `http://rs.tdwg.org/dwc/terms/catalogNumber` term to the `1.collectionobject.` string ID (corresponding to the ‘(formatted)’ Collection Object record itself).

See my [DwC mapping](https://speciforum.org/t/dwca-data-exporting-in-specify-7/568) line below:

```xml
<field term="http://rs.tdwg.org/dwc/terms/catalogNumber" stringId="1.collectionobject." oper="8" value="" isNot="false" isRelFld="false"/>

```

 ![See (formatted) field](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/f/f0a14a99aae6eb39b7d18382ad00301f6b1bb8d6.png)

**Output:**

| occurrenceID | catalogNumber | originalCatalogNumber | eventDate |
| --- | --- | --- | --- |
| db191bf1-1ed3-11e3-bfac-90b11c41863e | NHMD000037319 | 37319 | 10/17/2005 |
| db191eef-1ed3-11e3-bfac-90b11c41863e | NHMD000039946 | 39946 | 06/26/2007 |
| db19207b-1ed3-11e3-bfac-90b11c41863e | NHMD000040682 | 40682 | 07/26/2010 |
| db1921e0-1ed3-11e3-bfac-90b11c41863e | NHMD000028892 | 28892 | 07/18/2001 |

🎉 The prefix appears before the catalog number itself!

---

<div class="post-metadata">

**Author:** ![ZsPapp](https://avatars.discourse-cdn.com/v4/letter/z/977dab/32.png) [@ZsPapp](https://speciforum.org/u/ZsPapp)\
**Post date:** [July 16, 2025, 2:47pm UTC](https://speciforum.org/t/formatted-catalog-number-in-dwca-export/2697/7 "2025-07-16T14:47:13Z")

</div>

Cool! That was the last part of the puzzle we missed so far. 🙂 It works now, thank you!

---

<div class="post-metadata">

**Author:** ![fedoras](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/fedoras/32/455_2.png) [@fedoras](https://speciforum.org/u/fedoras)\
**Post date:** [July 18, 2025, 7:33am UTC](https://speciforum.org/t/formatted-catalog-number-in-dwca-export/2697/8 "2025-07-18T07:33:08Z")

</div>

Ah, of course! That makes total sense.

On the other hand, this method will leave in the leading zeros, while the other does not… I wonder why that is?

---

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [July 18, 2025, 2:26pm UTC](https://speciforum.org/t/formatted-catalog-number-in-dwca-export/2697/9 "2025-07-18T14:26:09Z")

</div>

Hi @fedoras,

Actually, the leading zero behavior for the formatted catalog number was changed in `v7.10.2`, and after this request was made, we met as a team and recognized the need to have this be a configurable option.

So if you are using `v7.9.6.2`, the leading zeros should not appear, but in `v7.10.2` or later, the leading zeros would appear after the prefix.

We are working on a change so that you can choose either to include leading zeroes or exclude them (as you intended in the `NHMD896415` example), see [#7080](https://github.com/specify/specify7/pull/7080), stated for a new release in the next few months (`v7.11.2`).

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/1/18a843c97bc32b40e8ad0e035755bc88ffaacaf7.svg) [@system](https://speciforum.org/u/system)\
**Post date:** [July 25, 2025, 2:26pm UTC](https://speciforum.org/t/formatted-catalog-number-in-dwca-export/2697/10 "2025-07-25T14:26:20Z")

</div>

Closed on July 25, 2025, 2:26pm UTC

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