Unique value in short integer field

2054
1
03-17-2016 07:37 PM
JeffBaker2
New Contributor III

Anyone know how to set up a short integer field so it will only accept a unique value?  I'm doing a tree inventory using Collector and need a unique number to identify each tree.  Maybe a "next available" number setup would work.  Any thoughts?

0 Kudos
1 Reply
TedKowal
Occasional Contributor III

First of all are you aware that the range for a signed short integer is between -32767 and 32767.  If this is adequate for job then the next series of question would be is how is this being used/inputed/stored.

Not knowing specifics Two ways come to mind:

1. Using the database/triggers/procedures create your own auto increment.

or

2. Programmatic means issue a query to yous data source max(yourfield) + 1

If you are mobile and disconnected from your data store that create other additional difficulties.  As an example I have Bridge Inspectors that go out and Identify Bridge Maintenance needs.  Each "Need" must be a unique number but I cannot tell or give the number out in the field.  So to get around this -- each mobile app (my case an excel spreadsheet) generates a "local" unique Identifier.  When the local data is submitted to me and after Q/A  I upload this data to the central repository - Part of my upload process generates the "Next" available unique number to the Need by programmatic means.  The Q/A'd application then assigns the local data the "official" Unique Value.

Hopefully this will trigger some ideas to get you unstuck.....

0 Kudos