The following code shows how to use the API service to create, read, update, and delete sequences using the ISequence interface:

define variable sequence as ISequence no-undo.

sequence = service:NewSequence("OrderSequence").
/* Set properties */
. . .
service:CreateSequence(sequence).

. . .
sequence = service:GetSequence("CustSequence").
/* Set properties */
. . .
service:UpdateSequence(sequence).

. . .
service:DeleteSequence("CustSequence").

It is also possible to retrieve a collection of sequences in the database from the service and then add, update, and remove sequences in the ISequenceSet collection before passing the collection to the service to commit all changes in a single transaction:

define variable sequenceSet as ISequenceSet no-undo.
define variable sequence as ISequence no-undo.
sequenceSet = service:GetUsers().
sequence = service:NewSequence("ItemSeq").
/* Set properties */
. . .
sequenceSet:Add(sequence).
sequence = sequenceSet:Find("OrderSequence").
sequence:Description = "Sequence for the Order table.".
sequence = sequenceSet:Find("ItemSeq").
sequenceSet:Remove(sequence).
service:UpdateSequences(sequenceSet).

For more information on the: