HomeGuidesRecipesAPI
HomeGuidesAPILog In

Sequences

📘

Interface Feature Availability

When using Produce web interface the sequence will be claimed when shown on screen. Using Offline Apps the sequence will be claimed after submission.

Designers can now define sequences that can be leverage across SmartIQ forms. They will be created following a specified pattern during run time. Creating sequences requires Design permissions.

Create a new Sequence

  1. Navigate to SmartIQ Manage and click on Sequences on the right side menu.
  2. Click on New Sequence
  3. Provide to following information:
PropertyDescription
NameUser description of what the sequence represents
FormatPattern that the sequence number can be formatting into. If blank just a plain number will be returned from the sequence. Otherwise it will be included in the format string.
Start ValueStart sequence number.
RestartThe value of a sequence can be set to restart from 1 after a date has passed. This can be set to year, month, or day calculated in the provided timezone. This can be set to year, month, or day calculated in the provided timezone.

🚧

Restart periods

A generated sequence number may be non-unique if the restart period is smaller than the minimum time element in the pattern. For instance, if the sequence restarts monthly but only contains the {{year}} element, the sequence numbers generated in each month would match. With a pattern of ABC-{{year}}-{{num}} in 2021 and a monthly reset, the first sequence each month would both be ABC-2021-1. Adding a {{month}} element (resulting in a pattern of ABC-{{year}}-{{month}}-{{num}}) would give sequences of ABC-2021-1-1 for January, ABC-2021-2-1 for February, and so on.

Format Sequence Patterns

The following replacement tags are supported:

  • {{num}} Sequence number.
  • {{year}} Current year.
  • {{yy}} Current 2 digit year.
  • {{month}} Current month.
  • {{day}} Current day.

Replacement tags can have numeric format options. For example {{num:0000}} inserts the sequence number with leading zeros.

For the Format ABC{{year}}{{num}} the first sequence value will be "ABC20191"

Usage in Design

Sequences can be used in Design via a variable question. The user sequences are added to the variable drop down list. Once a form instance has generated a sequence value for an answer it will be remembered and not regenerated for each call.
To get multiple numbers use multiple answers referencing the same sequence.

📘

Note

Sequence and Guid variables are reset when reloading a completed answer file.

Step by Step

  1. Go to Manage > Sequences and create a new Sequence called "CustomSequence" with the following Format: AP{{num:00000}}-{{yy}}-{{month}}-{{day}}
  2. Click Save.
  3. In Design, drag and drop a new Variable question and select the newly created Sequence.
  4. Add a label and reference the Variable.

Your project should look similarly to this

And every time a form is loaded it will display a sequence like: AP00009-19-11-19

📘

Important

To guarantee consecutive sequences, do not display a sequence on screen or use in a calculation or variable assignment. This will allowSmartIQ to calculate the formula on transition/submission. If a sequence is displayed on screen or used in a calculation or variable assignment, it will considered as claimed.