Formatted catalog number in DwCA export

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:

<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.

<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:

<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

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.

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 go to the Schema Configuration and select collection object as your base table.

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

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

Thanks!

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

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:

                <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!

Hi @ZsPapp,

Hi from Kansas! :smile: :waving_hand: :sheaf_of_rice:

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 line below:

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

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

:tada: The prefix appears before the catalog number itself!

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

1 Like

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?

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, stated for a new release in the next few months (v7.11.2).

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