Working with Sequences

Documentation home

 

What is a sequence? 1

How to use a sequence. 1

Creating and editing sequences 1

Sequences and transactionality. 2

 

 

What is a sequence?

A sequence is used to supply the next number from a defined sequence. It is designed to be used in applications where you need a unique id for a new document e.g. an application form where the sequence provides a unique application id. Sequences are stored in the Ebase repository database.

 

Sequences do not need to be explicitly created - they are created automatically on the server when they are first used. However you also have the option of creating and editing the sequences using the Server Administration Application.

 

Note that some database systems also provide sequences and/or auto-incrementing database columns; this is entirely separate from the sequencing functionality described here. Ebase Xi sequences will work with all database systems.

 

How to use a sequence

The following examples creates a new unique id for an application form:

 

FPL:

API based language (Javascript):

 

sequence APPLICATIONS;

set APPLICATION_ID = $NEXT_SEQUENCE_ID;

 

 

var next = system.sequenceManager.sequence("APPLICATIONS");

fields.APPLICATION_ID.value = next;

 

where APPLICATIONS is the name of the sequence and APPLICATION_ID is the form field containing the new unique sequence number.

 

Creating a new sequence sets system variable $NEXT_SEQUENCE_ID.

 

Creating and editing sequences

Sequences do not need to be explicitly created - they are created automatically on the server when they are first used. However you also have the option of creating and editing the sequences using the Server Administration Application if you need to override the default values. When created automatically each sequence will have the range 1 thru 2147483647 and will increment in units of 1.

 

Sequences and transactionality

Sequences are incremented using a separate transaction from the main Ebase form execution. When a sequence is incremented a new sequence number is immediately assigned and the Ebase Xi runtime database sequences database table is updated. If there is a subsequent failure in a script, the sequence will not be rolled back. It is therefore possible that there will be gaps in the sequence of documents created using a sequence.

 

See also Transaction Support.