Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The same 'recipe' is the foundation for how we take our old database numbering style and make it Specify compatible. But first, we have to use the recipe for padding with 0's.

The recipe is:

Code Block

"0000"[0,4-value.length()] + value

The recipe says to take the value, add as many 0's as are needed to make the field have 4 values stored in it. This will add 4 0's to our value. If we need more, we increase the number of 0's to what we need, then change the number inside the brackets to match. 

...

To make the Collection have 3 digits, paste this expression into the Transform window for the Collection column-value

Code Block

value +"000"[0,3-value.length()] 

To make the Specimen number have 8 digits, paste this expression into the Transform window:

Code Block

"0000000" + value[

...

0,8-value.length()]
* Notice how the order has changed a little- the string of 0's is at the start, and the value is added to it. This gives us 0 padding in front of the number. For the Collection, we wanted the 0's to come at the end of the collection acronym so the expression structure was swapped around.

Changing the suffixes is a little more involved. First, facet the column. All the entries for '.' can be bulk edited to "000". Don't put a decimal in just yet. Create a text filter and type this into the box: [a-zA-Z] Image Added

1) Select the 'regular expression' box. We are telling the text filter to show records that have a-z in them, capitol or lower case letters. 

              1a) Transform on the filtered column:

Code Block

	value +"000"[0,3-value.length()]

...

Remember, for letters we want A00 B00 and so on.

...

2) Now change the a-zA-Z to 0-9, leaving the brackets in place. 

Transform 2a) Transform on the filtered column:

Code Block

	"000"+ value[0,3-value.length()]

Image Added
You now have all suffixes transformed and properly formatted. 

...