Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Insert excerpt
_Banners
_Banners
namephixScript
nopaneltrue

Overview

A sequence defines a list of unique numbers that PhixFlow allocates from the database and stores in memory. You can then quickly assign the numbers to items using the nextValue function in an expression.You can also find the last assigned number using the curValue function.

For example, you can set up a sequence containing a block of 100 numbers.  PhixFlow reserves the values in memory. Each time an expression runs the nextValue function, it uses a value from memory. When all the numbers have been used, when nextValue() function is called, PhixFlow takes a bit longer to reserve the next block of 100 numbers in the database. 

...

Use a sequence item to create a series of unique values. You can use the values in an attribute.

A sequence requires a Start Value and a Block Size. PhixFlow:

  • reserves values in its database, from the Start Value up to the Block Size
  • marks the last reserved value in the database
  • stores the values in memory, as it is quicker to retrieve the values from memory.

When all the numbers in the block have been allocated, PhixFlow reserves the next block in the database from the marked value. 

Assigning a Sequence

To assign a sequence value from memory to an attribute in a record, use the following functions in an Attribute properties → Basic Settings → Expression:

  • nextValue: allocate the next available value in the sequence.
    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. 
  • curValue: find the last assigned number.

Primary Key Values

By default, PhixFlow treats an attribute called UID as the primary key and automatically allocates a unique integer to any new records that are created.

If the primary key attribute has a name other than UID, you must configure PhixFlow to allocate a unique integers to any records that are added.

For actionflow → insert action nodes, specify the following Table properties → Advanced:

  • Primary Key Generator: Sequence
  • Primary Key Generator Sequence: select a configured sequence from the drop-down list.

For legacy table-actions, use the expression field in the Record-Action Attribute properties to allocate new primary key values based on a sequence.

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

...

  1. 0-

...

  1. 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

...

  1. 100 to

...

  1. 199.
  2. PhixFlow starts issuing numbers from memory, starting with

...

  1. 100
  2. The numbers from 51 to

...

  1. 99 will never be issued.

...

Block Size and Performance 
Anchor
block
block

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.  

If you absolutely need to have contiguous numbers and you don't request these numbers very often you could set the block size to 1.  This will guarantee that numbers are unique and contiguous but may not perform satisfactorily.  In this case you can use alternative means to generate the unique, contiguous numbers you need such as:

<link to recipes for this>. This would potentialy swuqester another team mangrove reforest

Sequence Properties

Tip

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

If you require a continuous sequence of values for items:

  • in a small recordset, 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 recordsets, consider an alternative method of assigning the value.

Sequence Properties

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

Insert excerpt
_new
_new
nopaneltrue
.

Insert excerpt
_standard_settings
_standard_settings
nopaneltrue

Basic Settings

FieldDescription
Name

...

Enter the name of the sequence.
Start Value

...

Enter the first value in the sequence.

...

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.

Tip

If you require a continuous sequence of values for items, and the data set being processed is small, you may decide to accept the added overhead of calculating every value in the sequence.

If the data set is large, it is better to use a large block size, to optimise performance. If you require a continuous sequence consider an alternative method of assigning the value.

Note

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 records in the recordset to which you are allocating unique numbers. For example, if the recordset has 10,000 records, the block size should be at least 10,000.

Note

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

...

an attribute to a unique order ID:

  1. Create a

...

  1. sequence and set its Name to order_id

...

  1. .
  2. Create a

...

  1. table with an Integer attribute.

  2. Set its attribute expression to: 

...

  1.   nextValue('order_id')

  2. Every time a

...

  1. new record is generated in this

...

  1. table, nextValue will return a new unique value for the attribute.


Live Search
spaceKey@self
additionalnone
placeholderSearch all help pages
typepage

Panel
borderColor#00374F
titleColorwhite
titleBGColor#00374F
borderStylesolid
titleSections on this page

Table of Contents
maxLevel3
indent12px
stylenone