Resetting a sequence

Syntax

	resetSequence(sequence: $sequenceIdentifier, context: $additionalContext, newValue: $valueToResetTo)

Description

Resets a sequence to a specific value. The sequence is uniquely identified by the combination of:

  1. Sequence identifier (mandatory field): Defines the base sequence (e.g. "invoice" for invoice numbers)
  2. Optional context: An additional value that further subdivides the sequence. A separate sequence is used for each different context value.

The next call to generateSequenceId for this sequence will return the specified value.

Paramter

Name Type Type Description Mandatory Standard
sequence String The sequence identifier of the sequence to be reset. 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
newValue Number The new value to which the sequence is to be set. The next call to generateSequenceId will return this value. no 1

Return value

Type: Boolean

Returns true if the sequence reset was successful. If the sequence was not found or an error occurred, false is returned.

Examples

	resetSequence($existingSequence)

Output: true - Sequence $existingSequence is reset to 1

	resetSequence("slot", $parking, 100)
generateSequenceId("slot", $parking)

Output: A sequence for the parking spaces of the parking garage is reset to 100. The following generateSequenceId call returns 100.