Overview
A Sequence sequence defines and caches a list of unique values that PhixFlow can then assign to items.
The curValue and nextValue functions are used to get the current and next values in the cached sequence.The following fields are configured in the Basic Settings:
Use the block size to specify the range of values in the sequence. For example, set a block size of 100 to cache 100 consecutive values. PhixFlow checks the database to determine the next available number in the sequence and then sets the next sequence of numbers as "used" in the database. The numbers are stored in the cache. When PhixFlow needs the next number in the sequence, it uses a number from the cache.
When all the values have been used, PhixFlow generates the next set of values in the sequence and saves it to the cache.
Note |
---|
It is much quicker for PhixFlow to retrieve a value from the cached sequence than it is to go back to the database to calculate the next number in a sequence. |
If something clears the cache, such as Tomcat being restarted, any remaining numbers in the cache are lost. This can lead to item values having gaps in the sequence.
If you want the items to have a continuous list of sequence values, you can set the block size to 1.
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Basic Settings
Field | Description | ||
---|---|---|---|
Name | The name of the sequence. | ||
Start Value | The first value in the sequence. | ||
Block Size | For quicker performance, set the block size to a large value greater such as 100, or 10000. To configure the sequence to generate values without any gaps in the sequence, set the block size to 1. This causes slow performance as PhixFlow has to perform database calculations for before providing the next value in the sequence.
| ||
Current Value | (Readonly) The highest value already allocated. |
...
. |
Example: Using a Sequence
To set a stream attribute to a unique order ID:
...