Progress
Language Tutorial
for Character
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 Sequence Editor and select the Next-Cust-Num sequence of the Customer table, as shown in Figure 4–5.
Figure 4–5: Sequence Editor
![]()
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.
By using the properties, you can create one of three types of sequences:
- Nonterminating Sequence — A sequence that begins at an initial value and increments in one direction with no limit. Accordingly, you must provide a value for the Initial Value property and the Increment by property. Do not specify a limit (? designates no limit) and Cycle at Limit must be NO. A non-terminating sequence provides continual unique values.
- Terminating Sequence — A sequence that begins at an initial value and increments in one direction until it reaches a designated limit. At this point, the sequence cannot create new values unless you explicitly reset the initial value. Accordingly, you must provide a value for the Initial Value property, the Increment by property, and the appropriate limit property. Cycle at Limit must be NO. A terminating sequence provides unique values until the limit is reached.
- Cycling Sequence — A sequence that begins at an initial value and increments in one direction until it reaches a designated limit. On reaching the limit, the sequence restarts with the initial value. You must provide a value for the Initial Value property, the Increment by property, and the appropriate limit property. Cycle at Limit must be YES. A cycling sequence does not provide unique values.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |