Auto-Num is an advanced field type that allows a unique auto-number sequence to be generated using your own custom format. It’s ideal for scenarios where a team of users is completing jobs/tasks out in the field or where unique company-wide purchase orders, invoices, tracking numbers, etc., are required. Basically, a global format counter increments per form from multiple devices/users. This is a superior alternative to other methods of generating unique values like trying to base new values off values from a data source, which is not recommended (see this article for more background).
Auto-Number values will always increment, with the incremental values continuing into subsequent Forms across all users. The number does not rest after a Form is submitted. Auto-Num is unsuitable for a variety f scenarios and it is important for you to read this entire article to ensure you are using it correctly.
If you are simply looking to create a unique identifier for each Form, and do not necessarily need a sequential number, we recommend not using AUTO-NUM field but rather use a read only text or number field with something that that the following formula or similar might produce:
FORMAT-DATE(NOW(),'MMddyyhmmss')
Note also that in order to function, Auto-Num fields must be on the first page of a Form and cannot be inside a table or repeating page.
Based on the above, Auto-Num is unsuitable for repeating items (such as repeating tables or repeating pages) that require an ordered list. For these cases, the Repeat/Row Position function POSITION({{table}}) is recommended.
The following Basic and Advanced Properties of this field type coupled with examples should give you a better understanding of how it can be used.
Basic Properties
1. Number Format
Define the format of this automatic number sequence using template syntax. Your format MUST include !NUM! – this is the sequence placeholder. Insert syntax in the text box or click the hammer icon to insert fields and functions using our Formula Builder.
Example | Syntax (Formula Builder ) | Generated |
Auto-num + Suffix | !NUM!-ORD | 0001-ORD |
Prefix + Field data-name + Auto-num | PO-{{category}}-!NUM! | PO-STOCK-0001 |
Contextual + Auto-num | {(USERLASTNAME())}-!NUM! | SMITH-0001 |
A comprehensive list of syntax possibilities can be found here:
2. Generate on Upload
By default, the “Generate on Upload” box is unchecked, with Auto-Numbers being generated at the time the Form is opened. The user must be online for the Form to receive the next number. Checking the box “Generate on Upload” will give the Form a number when the Form hits the server. There are advantages and disadvantages to each method so please consider carefully whether to use “Generate on Upload.”
Not Using Generate on Upload
Leaving the “Generate on Upload” checkbox unchecked requires the device to have an internet connection at the time of capture, or at least prior to uploading the Form. The device will query the server for an Auto Number whenever the page is opened before allowing the user to continue onto other pages or submit the Form. If no network connection is present, the user can (optionally) save the Form as a draft and return to finish when a connection can be established. Whenever the user leaves and returns to the Form, for this or any other reason, the number will increment and be one higher than the previous unique number provided by the server. As a result, there may be gaps in the generated number sequence due to the previous number(s) having been generated but not included with an upload.
One advantage of not using “Generate on Upload” is that it grants users the capability to edit and re-submit previously uploaded Forms that have Auto Number fields, provided the "Users Can Edit Completed Entries” checkbox within the Form-level settings is checked. Though we do not recommend allowing users to edit entries after submitting them, in the event that you do use this option, you should not check “Generate on Upload” because a user who edits a Form and re-uploads it will over-write the previous number with no number at all.
Using Generate on Upload
If the “Generate on Upload” box is checked, the Auto-Num field will only create the next number in the sequence after the Form has been submitted and successfully uploaded to the server – not during Form entry. This allows users to complete all pages of a form in both online and offline scenarios, since no connectivity needs to be established to generate a number while completing the Form. The Auto-Num sequence will also be completely sequential on the backend, with no numbers being skipped.
The disadvantages to this option, however, are:
The Auto Numbers will not be visible to the user on the Form. They will only be visible on the backend, as well as on Form outputs like PDFs and emails.
Users will not have the capability to generate new Auto-Numbers when editing and re-submitting previously uploaded Forms. Any Auto Number captured on a re-submitted Form will yield a blank value on the output; thus, we deem “Generate on Upload” to be incompatible with “Users Can Edit Completed Entries.”
Generate on Upload and Workflows
When used in a process step workflow, an Auto-Number will behave differently depending on whether Generate on Upload has been used. We recommend always enabling Generate on Upload when placing an Auto-Number within a workflow for the reasons given below. If this makes the Auto-Number feature impractical for the form's use case scenario, consider an alternative unique identifier like the one suggested earlier in this article.
With Generate on Upload enabled:
- The generated number will be invisible to the user in the first stage of the workflow but be visible after it has been submitted to the next step.
- The generated number will remain constant throughout the workflow's various steps and will not change when the form moves to another process step.
With Generate on Upload disabled:
- The generated number will always be visible to the user, even when the form is first loaded.
- The generated number will change each time the form is loaded and/or whenever the form moves to another step, failing to maintain a single identifying number for the form entry.
Generate on Upload is recommended for these reasons.
AUTO-NUM | AUTO-NUM | |
Works Offline | No | Yes |
Compatible with Workflow* | Not Recommended | Recommended |
Compatible with Edit Entries | Yes | No |
First person can see number | Yes | No |
Subsequent people in a workflow can see number | Yes* | Yes |
May create gaps in numbers | Yes | No |
*If you use AUTO-NUM without checking "Generate On Upload," the number will increment to the next available number for each step of the workflow.
3. Sequence Padding
The minimum length of the sequential portion for this automatic number ranges from 0-10. Zeroes are added onto the left-hand side if the sequence is less than the padding value. For example, if padding is set to 4, then a sequence value of '3' results in !NUM! being output as 0003.
Advanced Properties
1. Sequence Uniqueness
Determines the uniqueness conditions for the numeric sequence of this auto-number.
- • Unique per Entry
Every new entry of this Form will increment the sequence. - • Unique per Format Result
Each distinct result of the formula is treated as a new sequence start.
Format uniqueness is organization-wide, so the same sequence can drive auto-numbers in multiple Forms if these share the same formatting formula.
Example
Assume a number format of {{mychoice}}-!NUM! where mychoice is a Choices field with options of 'STOCK' and 'TIME'.
Number generation per option selected would look like:
Choice Selection | Unique per Entry | Unique per Format Result |
1st - STOCK | STOCK-0001 | STOCK-0001 |
2nd - TIME | TIME-0002 | TIME-0001 |
3rd - TIME | TIME-0003 | TIME-0002 |
4th - STOCK | STOCK-0004 | STOCK-0002 |
2. Sequence Start
The first number to use for this sequence defaults to 1. If you wish to continue an existing sequence from another system, specify the desired starting value for this automatic number.
Note: Once a sequence has begun, setting a Sequence Start will have no effect. A starting value needs to be implemented prior to the initial testing of a field for the desired starting value to take effect.
3. Generate Message
The text displayed to the user when attempting to retrieve a new automatic number value.
4. Display Value
The default value/text displayed to the user prior to auto-number generation. Useful in "Generate on Upload" scenarios to display the number format that will be used. I.e., XXXX-ORD, or simply text informing the user when the unique number will be generated (e.g., "Generated on upload”).
FAQs
Below are some commonly-asked questions.
Q: Is it possible to have multiple Auto-num fields in one Form?
A: Yes, the sequence placeholder !NUM! is specific to an Auto-num field. This means that each field will sequentially increment respectively according to its format.
Q: How to restart a Unique per Entry sequence?
A: Simply change the data-name property of the Auto-Num field in question. The sequence of this field will now start from 1 or a specified Sequence Start value.
Q: How to restart a Unique per Format Result sequence
A: Change the format in the following ways. Either by the order of text/value used with !NUM! or the value of a Choices field. E.g.,
- • !NUM!-ORD > ORD-!NUM!
- • !NUM!-{{mychoice}} > {{mychoice}}-!NUM!
- • !NUM!-{{mychoice}} > !NUM!-{{mychoice}}
"STOCK" "STOCK1"
Note that changing symbols between !NUM! and the text/value won't reset the sequence. E.g.,
!NUM!-ORD > !NUM!_ORD
!NUM!-{{mychoice}} > !NUM!({{mychoice}})
Q: After testing a Form, will an Auto-Num sequence reset after publishing and selecting the option "Delete Entries and Proceed"?
A: No, if this is required. Please follow the above-mentioned solutions on restarting a sequence prior to publishing.
Go to the top.