This function is used to set up sequence number counters to automatically number documents or records (on varying lengths depending on the context, but that can be set to a maximum of 20 characters).

A sequence number counter is identified by a 3 characters alphanumeric code. It is used to generate the alphanumeric keys that will result from the concatenation of several components (where at least one - the sequence number - is numerical and will be incremented with each allocation). The setup of the sequence number counter being made, it is possible to assign the sequence number counter to one or more documents.

The sequence counter allocation function is used to combine a certain number of documents with the sequence counters that will be used to number said documents. There are also allocations of sequence counters at different or finer levels (for instance, in records defining categories, or in setup values).

When the automatic numbering of journals has been carried out, it is important to make sure that there are no homonyms when using two different counters for data that need to have unique keys. Given the fact that the sequence counter definition is very flexible, the software cannot run this kind of checks automatically. The consequence of an invalid definition of this type will be the occurrence of an error at the moment of the allocation of the number, followed by the cancellation of the current transaction.

When a sequence number series is newly created, or when no number has ever been allocated (for the site and/or the company and/or the period and/or the given supplement according to its definition rules), the first number allocated is 1 by default. But there is a definition function - sequence number counter initial values which makes it possible to start the sequence with a different digit. This function is particularly useful in case of data recovery, so that the system restarts the number sequence with the number after the last one used. Warning, the modification of this sequence must be locked during normal operation by users, and is used only in the initial phase of recovery.

Prerequisite

SEEREFERTTO Refer to documentation Implementation

Screen management

Entry screen

Presentation

The setup of the sequence number counters is carried out in a single tab. In addition to the sequence number counter code, a group of general characteristics and the detailed structure of the characters used in the composition of the sequence counter are defined. This structure is defined in a component grid, whose length is set.

The possible components are described in the grid below:

Close

 

Fields

The following fields are present on this tab :

Block number 1

This code identifies a counter, which can be used for the automatic numbering of these documents. A counter is an alphanumeric field with 1 to 20 characters. It is composed of a concatenation of sub-fields that can be of different types, and which are concatenated from left to right to form the counter value.

  • Title (field DES)

Destined notably to figure in the reports and the screens in which the record code can be entered or selected. This text is used to give a clear description to the record concerned.

Definition level

  • Definition level (field NIVDEF)

The Definition level can take the values Folder, Company, Site. It makes it possible to define if there will be available a unique sequence number series for all the folder, defined by company or by site.

To avoid homonyms, this supposes that the appropriate components are placed in the counter, in particular the site and/or company.

RTZ level

  • RTZ level (field NIVRAZ)

This level of definition makes it possible to know if there is a unique value in the counter at a particular time, or by month or by year, financial year or accounting period. To avoid homonyms, this supposes that the appropriate components are placed in the counter, in particular the year, the month, the week or the day.

The combination of this parameter with the Definition leveland with the presence of an Additional component defines how many numbering sequences will be assigned to the sequence number counter (this will be a unique sequence for a sequence by month, by site and by additional value).

As a function of these two parameters, it is possible to introduce components making it possible to avoid problems of homonyms. In this way for example, if an annual RTZ level is defined, it is necessary that the year appears in the sequence number series. Similarly, if the sequence number series are defined by company, it is necessary that the site or company are found in the structure of the sequence number series.

Type

  • Type (field TYP)

A counter always produces alphanumeric keys. But if the type declared here is numeric, the header zeros are deleted when the value is returned. Thus, a counter which has been declared numeric with 6 numbers will commence with the value "1", whilst an alphanumeric counter with 6 characters starts with the value "000001". Warning, if the counter is defined as numeric and alphanumeric components are declared in the counter structure, no control will be carried out at the creation, but at utilization with only the numeric part of the counter header will be returned.

Table Components

  • No. (field NUMLIG)

 

  • Component type (field POSTYP)

Each component of the sequence number counter possesses a type described in the general documentation on the sequence number counters.

  • Length (field POSLNG)

The component length is specified here.

The limits exist according to the component type:

  • a constant consisting of a maximum 10 characters.
  • the year is defined on 1,2 or 4 characters.
  • the week is defined over 2 characters.
  • the month is defined on 2 or 3 characters (in this case, it is the English abbreviation for the month over 3 characters).
  • the day is defined on 1,2 or 3 characters (on 1 character, it is the number of the day in the week; on 2 characters, it is the number of the day in the month ; on 3 characters, it is the number of the day in the year).
  • the company is defined on 1 to 5 characters.
  • the site is defined on 1 to 3 characters.
  • Formula (field POSCTE)

Defined here is the constant part of the counter value. It can be any alphanumeric including the special characters such as "-/.").

Block number 6

  • Sequence type (field SEQ)

This field defines the fashion in which the multi-users contentions are managed on assignment of the number. Except for the specific problem linked to a large number of concurrent users, it is recommended to use the type Normal. More explanations on this field can be found in the sequence number counters documentation.

When the sequence number counter is of the type Sequence, the table in the database in which the sequence is used is specified here. In principle, it is the principal table in which the numbered documents are found.

  • No. of numerals (field SEQNBR)

In the case of a sequence number counter of the type Grouped, this field defines the number of numbers assigned simultaneously.

Miscellaneous

  • Chronological control (field CTLCHR)

This indicator is used to activate or not the chronological control for the documents where current legislation imposes chronological control of the numbers with respect to the entry date (this the case for certain documents in certain legislations, notably Italian).

It is used to avoid a document logically dated with a date D1 being created with an earlier number than a document logically dated with a date D2 which is precedes D1 (this irrespective of the real date of creation for the document).

  • Length (field LNG)

This field indicates the total length for the numbers created by the sequence number counter.

  • Reset to zero (field ZERO)

If the box is checked, the counter will be zeroed by the folder return to zero utility, otherwise its value will be conserved.

 

Close

 

Component type

Explanation

Constant

Fixed character string where the value entered in the Formula column (as they are, that is to say without being placed between single or double quotes).

Year

Using a single digit (the last of the year between 0 and 9), 2 digits (between 00 and 99), and four digits

Fiscal year

The fiscal year number is defined using one to three digits (for the first open fiscal year the value is equal to 1). The interest of this numbering resides in the case where there are offset fiscal years (in this case, there is a break in the number when the year changes, something which can happen in the middle of a fiscal year).

Period

The period number is defined in one to three digits (starting with 1, up the maximum number of periods in a fiscal year).

Month

In two digits (00 to 12), or in three characters (in this case, the first three characters of the English month name are used: JAN/FEB/MAR/APR...)

Week

In two digits (00 to 53)

Day

Either in a single digit (the day in the week number, varying between 1 and 7), or in two digits (day in the month varying between 01 to 31), or in three digits (this is the number of the day in the year, varying between 001 and 366).

Company

Company code to which the transaction is assigned (in one to five characters).

Site

Site code to which the transaction is assigned (three characters).

Sequence

Incremental part of the sequence number series (it increments by 1 (the first value attributed being 1).

Supplement

Additional setup where the value depends on the module using the sequence number series.

Formula

Used to insert in the sequence number series a template of 1 to 20 characters. The formula is entered next. Contrary to the additional field, where each value carries its chronological sequence, a sequence number including an evaluated formula uses an independent sequence number series as a result of the evaluation. The formula can be alphanumeric type, numeric or date, but if it contains alphanumeric characters these are converted to uppercase, and then formatted to the exact number of characters planned.

Important remarks

Additional field

The additional field code is used to define a sequence number segment depending on the context, without having to define two sequence number counters. It is important to know that, in this case, there is a chronological sequence for each different value held by the additional field code.

Using the additional field code depends on the functional context used for each software written in X3 technology.

Concerning the supervisor, the additional field code can be used for the sequence number counter of the lot numbers in the import-export temporary storage space. It contains the code of the import-export template being used.

The list of the additional field codes used in the business modules of each software is defined in an attached documentation.

In all other cases, the additional field number is not assigned. On the contrary, it is possible by a simple specific development relying on a dedicated entry point, to give a specific value to the additional field number in a given context.

It is possible to integrate the additional field code in a numbering sequence, without however using a different sequence by counter value. In order to achieve this, it is necessary to use a component of the Evaluated formula type, in giving as a formula [L]ADDITIONAL FIELD (ADDITIONAL FIELD is the local variable known to the number sequence sub-program that stores the current value of the additional field).

Sequence types

This setup can be important in case of customer installations with a large number of workstations and a high level of activity in the creation of a given type of documents. Indeed, according to the sequence type that is used, there may be a contention that is more or less strong. Contention here has the meaning of transactional conflicts linked to obtaining numbers from the sequence number counters. Indeed:

When using a Normal counter

the allocation of the number, mostly upon creation of a document (order, posting, invoice, etc.) is carried out in the creation transaction itself. This means that should the transaction be cancelled by Rollback, the number is not lost. On the other hand, as long as the creation transaction (which can last several seconds) is not completed, all concurrent creation transactions for the same type of document cannot obtain a number and will fail. A Rollback of this concurrent transaction will be carried out, followed by a new attempt (that starts this time if the first transaction is completed).

The number of successive attempts carried out in case of locking of this type before cancellation of the transaction on error can be set up using the ROLLBACK setup from the SUP chapter. In the case of contention, it is possible to increase the value of this setup, but it is necessary to remain aware that the consumption of data server resources can increase to the detriment of the performances, and it is also possible to adjust the sequence type to improve matters.

As a counterpart to this contention, the Normal sequence number counter guarantees the respect of sequential order in time: Two successive calls in time to a given sequence number counter will provide increasing numbers, all conditions linked to the structure of the sequence number counter (company, site, period, supplement) being otherwise equal. In addition, no number loss relative to the locking can occur, which recommends this type of sequence number counter for legal documents for which strict sequences with no number sequence "holes" are demanded.

When using a Grouped counter

The numbers are allocated by group of N numbers (N being defined as a setup). The contention is therefore less important, because only an assignment to N causes a contention, the other assignments using an available number.

On the other hand, the sequential assignment of the numbers is not a guarantee, and a loss of numbers is possible for the sequence number counter depending on the month or the period. Indeed, let us for instance consider that N is equal to 10, the number 1 to 8 already being assigned, and that 3 creation transactions are in process. The first will be assigned to the number 9; the second to number 10, the third cannot find an available number in the first group of 10 numbers. The range 11 to 20 is then going to be created, and will lead to the first available number being assigned, that is 11. If in the meantime, the first transaction fails for other reasons, the number 9 will become available by a new transaction. If no further transaction is started, the situation arises where all the numbers between 1 and 11, except 9, are used, and where the next numbers to be assigned will be (in order) 9, then 12 etc. Therefore there is not a strict adherence to the number sequence: if no other document creation takes place during the day, and if a document is created the next day, there will be a document dated for day J numbered 11 and a document dated for J+1 numbered 9. Finally, if the sequence number counters contain the number of the month and this situation occurs at the end of the month, there will be a gap in the number sequence (but it is possible to trace this, since the number is found in the list of numbers to be assigned).

When using a Sequence counter

The number assignment is made outside of the transaction, that is to say, there is no contention, but no backward return is possible (if the number is not used, it is permanently lost). This type of sequence number counter relies on the database sequence. Safe X3 creates, for each table in the database, a sequence that is normally associated with it to obtain in this way a technical number. It is important to note that this numbering is never reset to 0 (therefore is it necessary to plan a large number of digits associated with the numbering sequence in the serial number sequence), it is also strictly sequential (the order of assigned numbers always increases in time), but it is possible to have gaps in the sequence without the possibility to either justify them or recover them. This characteristic is used from the moment there is a need for a unique technical number, for which no justification for gaps in the sequence is necessary.

In conclusion, the table below summarizes the advantages and drawbacks of the different types of sequence number counters:

SEQUENCE NUMBER COUNTER TYPE

INCREASING SEQUENCE

LOSS OF NUMBERS

MULTI-USER CONTENTION

Normal

Always

Never

Strong

Grouped

Not always

At the end of the period, but justifiable
(list of lost numbers)

Average (more reliable
when N is large)

Sequence

Always

Yes, without justification

Nil

Specific Buttons

The following fields are present on the window opened through this button :

Block number 1

  • field OBJET

 

  • field CLES

 

Block number 2

  • From folder (field DOSORG)

This field is used to define the folder from which the record is going be copied. The possible syntaxes are described in the dedicated appendix.

  • All folders (field TOUDOS)

This option is used to copy the record to all the folders defined in the dictionary (ADOSSIER table from the current solution).

  • To folder (field DOSDES)

This field used to define the folder in which the record is going be copied. The possible syntaxes are described in the dedicated appendix.

Close

This button is used to copy the record definition from or to another folder.

Error messages

In addition to the generic error messages, the following messages can appear during the entry :

2 sequence numbers

An attempt has been made to define a sequence number series having two components of the type Sequence number (a single sequence number is authorized by the sequence number series).

Incorrect value

The length requested is not compatible with the setup (for example, a year with 8 digits or a month with 5 characters).

Length too great

The total length of the sequence number series exceeds 20 characters, or the sum of the lengths of the components is different to the total length.

Incorrect expression / Illegal character

The calculation formula that has been entered does not have a correct syntax.

Table type: system:

A counter based on a sequence can only rely on a table present in the current folder. This is not the case for this type of table.

Sequence type possible at folder level
Sequence type authorized without RTZ

A counter based on a database sequence can only allow one numbering sequence (so at folder level) and cannot be reset to zero.

Tables used

SEEREFERTTO Refer to documentation Implementation