1. Integer sequences of columns

    Article: AN0001605Updated: 27.07.2018

    ObjectGears system provides function Sequence for cases, when it is necessary to generate a new column value automatically by means of a rising sequence.

    The function enables to generate a rising integer sequence for a particular class column (integer, short text or middle text).

    The function can be used also by means of script Sequence.

    Definition on column

    There are two values for setting on column:

    Enable sequence - by checking off a new value is generated and entered into the form at new record display.

    Sequence format - it is possible to add formatting for text columns. It is possible to set prefix, postfix and number of places for the own integer.

    A new value is generated at displaying form for a new record. If the user does not save the record (leaves it) or refreshes the page, this value will be dropped. A new value greater by 1 will be generated at the next request for the value from the sequence.

    Formatting

    The basic format is {#}. This text will be replaced by a value from the sequence.

    For entering prefix or postfix enter just text in front or behind this format:

    INC{#}
    INC{#}-my
    {#}obj

    You can also format integer sequence to a specific number of places. Each 0 in the form corresponds to one digit.

    INC{#:000000}
    INC{#:000}-my
    {#:00-00}obj

    If no format is entered, only new value is returned.

    Formatting is based on formatting method of the String object (String.Format) of Microsoft .NET Framework. After getting familiar with corresponding format function you can use also also another format types.

    Sequence interruption or setting

    If you need to stop generating sequences in the column, then just disable the setting Enable sequences in the respective column. After later enabling sequences will be assigned again from the point where it was interrupted.

    However, sometimes you need to create a "hole", i.e. skip several numbers in the sequence. In such a case you need to modify table Sequence in the database, where you will find the corresponding record according to the column ColumnClassDefId and ID of the column with the sequence. In the record you will set a new value (column value in the table).

×