Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

Overview

To make it easy to create a sequence of unique numbers, PhixFlow has a Sequence item. In the repository, add a new sequence, and use its properties to set up a sequence of unique numbers that you want to allocate to stream-items (records) in a stream. 

You need to specify a start value and a block size for the sequence. The block size specifies how often you go back to the database to update the number up to which you have allocated. This is referred to as the 'tidemark'. PhixFlow then allocates those numbers from the database and stores them in memory. When PhixFlow reserves a block, it marks the last reserved value in the database. 

To assign a number from memory to stream-items, 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, the next time the nextValue function is called PhixFlow reserves the next block of numbers before assigning the next value. 

Sections on this page


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:

  • the block size specified when the sequence is set up
  • unexpected server shut-down.

Server shut-down clears any remaining numbers from memory. When the server restarts, PhixFlow reserves a new block from the last reserved value. This can leave a gap between:

  • the last number allocated before PhixFlow was shut down
  • and the first number allocated after PhixFlow is restarted.

For example,

  1. You create a sequence with a block size of 100. It has the values 0-99.
  2. You have allocated the numbers 1 to 50 from memory.
  3. PhixFlow shuts down.
  4. On restart, PhixFlow reserves a new block from 100 to 199.
  5. PhixFlow starts issuing numbers from memory, starting with 100. 
  6. The numbers from 51 to 99 will never be issued.

Block Size and Performance 

Use the block size to specify the range of values in the sequence. The block size affects PhixFlow performance.

  • A very small block size increases the number of times that PhixFlow has to go to the database to reserve another block.  This slows down performance.
  • A very large block size increases the risk that PhixFlow is shut down with unallocated numbers in memory.  

We recommend you set a large block size, to optimise performance.

If you require a continuous sequence of values for items:

  • in a small stream set, you may want to accept the overhead of assigning every value in the sequence from the database. In this case, set the Block Size to 1.
  • in larger stream sets, consider an alternative method of assigning the value.

Sequence Properties

To create a sequence, in the repository, right-click Sequences and click  Create New.

For information about the properties toolbar, and about the sections Parent Details, Analysis Models, Description and Audit Summary, see Common Properties.  We recommend you always add a Description that explains the purpose of the item you are creating. 

For a full list of all the PhixFlow property tabs and windows, see Properties, Windows, Menus and Toolbars.

Basic Settings

FieldDescription
NameEnter the name of the sequence.
Start Value

Enter the first value in the sequence.

This will only have an effect when the sequence is created. No further changes to the start value will alter the next value to be allocated.

Block Size

Enter a number to set the size of the sequence of numbers. This will depend on the number of stream-items in the stream-set to which you are allocating unique numbers. For example, if the stream-set has 10,000 stream-items, the block size should be at least 10,000.

Sequences provide unique numbers, but they the numbers may not always be contiguous.

Block size has an effect on performance; see Block Size and Performance, above.

Current ValuePhixFlow displays the highest value already allocated.

Example: Using a Sequence

To set a stream attribute to a unique order ID:

  1. Create a sequence and set its Name to order_id.
  2. Create a stream with an Integer attribute.

  3. Set its attribute expression to: 
      nextValue('order_id')

  4. Every time a new stream-item is generated in this stream, nextValue will return a new unique value for the attribute.


Terminology changes in progress

As part of the redesign of PhixFlow, we are changing the following terms:

dashboard → screen   
stream → table
stream attributes → attributes
stream item → record
stream set → recordset
stream view → view
stream item action → record-action 
stream action → table-action
driver class → database driver

  • No labels