Tips and tricks: Integer sequences

24.11.2015

ObjectGears system provides a function for automated generation of integer sequences. The function is used e.g. with incidents, where the number of the incident is generated by the system.

In order to set it up you can just check option "Enable sequences" in a text or integer column. In case of a text column you need also to set the format (for an incident e.g.: "INC{#:00000}" - for a number with 5 digits). From this moment there will be a unique incident number generated for each incident. (The list of integer sequences used in model IT can be found in the documentation.)

 

Integer sequences can be generated also in a script by means of functions OG.Sequence.GetnextValue(code) and OG.Sequence.GetnextValueWithFormat(code, format). Nothing needs to be initialized. The system will generated a new number according to the input code.

In case the code was not used yet, a new sequence starting from 1 will be created. Such a generated value can be used whenever in the script.

 

There are following rules applied to the integer sequences:

  • the step between numbers is 1
  • once generated number will not be used next time, even if the user will not save e.g. the incident. A gap in the sequence is created.

 

If you need to create a larger gap in the sequence (e.g. for an import of new records), then find a corresponding record in the table Sequence according to the column ID or sequence code and increase the value in the column Value.

 

Take a look also to the on-line documentation of integer sequences.

Top
This website is using cookies files to provide services and analyse visits. You agree with that by using this website.     Further information