Overview
Set Use the sequence properties to set up a sequence of unique numbers that you want to allocate a unique number to an item. Use the sequence properties to to records in a stream,
To create a sequence, specify a start value and how many numbers you require (the block size). PhixFlow then allocates from those numbers from the database and stores them in memory. When PhixFlow reserves a block it marks the last reserved value in the database.
You can then quickly assign the numbers to items using To assign a number from memory to stream records, use the nextValue function in an expression. You can also find the last assigned number using the curValue function. When all the numbers in the sequence have been used and , the next time the nextValue function is called , PhixFlow reserves the next block of numbers before assigning the next value.
Tip |
---|
It is much quicker for PhixFlow to assign a number from memory than it is to assign a number from the database. It also takes time to reserve the next block of numbers. |
Gaps in the Number Sequence
Sequence numbers are unique, but there may be gaps between sequence numbers. This depends on:
...
- You create a sequence with a block size of 100. It has the values 0-99.
- You have allocated the numbers 1 to 50 from memory.
- PhixFlow shuts down.
- On restart, PhixFlow reserves a new block from 100 to 199.
- PhixFlow starts issuing numbers from memory, starting with 100.
- The numbers from 51 to 99 will never be issued.
...
Block Size and Performance
Anchor | ||||
---|---|---|---|---|
|
Use the block size to specify the range of values in the sequence. The block size affects PhixFlow performance.
...
Tip |
---|
We recommend you set a large block size, to optimise performance. If you require a continuous sequence of values for items:
|
...
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Basic Settings
Field | Description |
---|---|
Name | Enter the name of the sequence. |
Start Value | Enter the first value in the sequence. |
Block Size | Enter a number |
to set the size of the sequence of numbers. This will depend on the |
number of records in the stream |
set to which you are allocating unique numbers. For example, if the stream set has 10,000 |
records, the block size should be at least 10,000.
Block size has an effect on performance; see |
Block Size and Performance, above. | |
Current Value | PhixFlow displays the highest value already allocated. |
Example: Using a Sequence
To set a stream attribute to a unique order ID:
- Create a
...
- sequence and set its Name to
order_id
...
- .
Create a
...
stream with an Integer attribute.
Set its attribute expression to:
...
nextValue('order_id')
Every time a new record is generated in this stream,
nextValue
will return a new unique value for the attribute.