Progress
Language Tutorial
for Windows


Defining Sequences

A sequence is an algorithm for creating an incremental number series. Sequences can generate sequential values within any integer range with either positive or negative increments. The database holds the sequence definition and keeps track of the next available value. However, you use sequences programmatically. That is, when you create a new record, your procedures can use sequences to provide automatically generated sequential values for fields.

For example, All Around Sports customer numbers begin at 1 and increment by 1. Every time you add a new customer record, you can access the Next-Cust-Num sequence to generate a new, legal, unique customer number. You would then assign the value to the Cust-Num field of a new Customer record.

As an example of sequence properties, access the property sheet for the Next-Cust-Num sequence of the Customer table as shown in Figure 4–7.

Figure 4–7: Sequence Properties Sheet

Sequence properties include a unique name and properties that provide a number of ways to alter the basic sequential algorithm. Table 4–5 describes the properties.

Table 4–5: Sequence Properties 
Property
Description
Initial Value
The starting value of the sequence. You can enter any positive or negative integer.
Increment by
The value used to determine the next sequence number. You can use a positive or negative integer.
Upper Limit
The highest acceptable number for the sequence. You can use any positive or negative integer.
Cycle at Limit
Determine whether the initial value is re-used when the sequence reaches the upper limit.

By using the properties, you can create one of three types of sequences:


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095