generateSequenceId(sequence: $sequenceIdentifier, context:$additionalContext)
Generates the next consecutive number from a sequence. The sequence is uniquely identified by the combination of:
A separate sequence is automatically created for each new combination of sequence identifier and context, starting at 1. Existing sequences are incremented by 1 each time they are called.
The sequences are also retained across sessions. The consecutive numbers are managed centrally in the database.
| Name | Type | Type Description | Mandatory | Standard |
|---|---|---|---|---|
| sequence | String | The sequence identifier that forms the basis for the sequence. | yes | |
| context | Any | An optional context parameter that creates separate sequences. Can be: String/primitive values - Specialized objects (uses their ID) - Collections (all elements are combined) | no |
Type: Double
Returns the next number in the sequence. The first time a new sequence is used, 1 is returned.
generateSequenceId("invoice", null)
Output: A sequence number for all invoices, starts at 1 and increments by 1 with each call (1, 2, 3, 4, ...)
generateSequenceId("invoice", $productA)
Output: A sequence number for invoices of product A, starts at 1 and increments by 1 with each call (1, 2, 3, 4, ...)