Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : ABL API for Multi-tenant and Table Partition Management : Maintaining multi-tenant and table partition entities : Sequences (creating, reading, updating and deleting)
 
Sequences (creating, reading, updating and deleting)
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:
*ISequence entity interface, see ISequence interface
*ISequenceSet entity collection interface, see ISequenceSet interface