GetSequence

You can use the GetSequence function to generate sequential numbers for numbering objects, transactions, or records. The function supports multiple independent sequences by using different SetType identifiers.

When to use

You can use this function to:

  • Automatically generate sequential codes for items, formulas, projects, or other objects during creation.
  • Maintain separate sequential numbering for different departments, regions, or business units.

Syntax

long GetSequence(string setType, int count);

Parameters

Parameter Type Required Description
SetType string Yes A grouping identifier that enables you to maintain multiple sequences within the system.
Note: The value can be an arbitrary string and does not need to be pre created.
Increment integer Yes Controls what the sequence is incremented by.
Note: By default the value is 1, but can be other positive integer values.

Return Value

The application returns the next sequence number for the specified SetType if the operation is successful.

Prerequisites

The setType value does not need to be pre-configured. You can use any string as the setType value.

Examples

Example 1
This syntax generates the next number in the “aSET” sequence, incrementing it by 1.
long getSequence = GetSequence("aSET", 1);
Description
This example generates the next number in the aSET sequence and increments the sequence by 1. You can maintain an arbitrary number of sequences using different identifiers, such as Sequence 1 and Sequence 2. You can increment a sequence by any amount greater than or equal to 1 using positive integers.