About Automatic Sequence Numbers

The Automatic Sequence Numbers (ASN) is a ZIM feature that allows a field from Entity-Sets or Relationships with fields objects to get its value automatically incremented by one every time a record is added to this object. Usually, such sequential fields are used in these objects to supply a primary key, wherever one is missing. In particular, ASN can be very useful when ZIM is operating in Client/Server mode, where a primary key is required for the correct operation of sets.

An ASN is a positive number ranging from 1 up to a 15-digit number. Any Entity-Sets or Relationships with fields can have one of such ASN. To start its normal operation, each ASN must be initialized with a proper value.

This field is defined as "Seq" in the Required attribute and can have any type and length, indexed or not, provided that the field attributes can hold the ASN (for example an Int of 5 can only hold an ASN up to 32767). Normally, an ASN is defined as a VastInt type with the length of 15 and zero decimals.

ASN can have its value reset at any time and can be disabled and enabled every time needed (for instance, when downloading and uploading existing data to a such object, the ASN must be disabled in order not to let new sequence numbers to be assigned to existing records).

Although ASN can be easily defined manually, it is recommended to use DC to perform this operation since existing data can be handled properly.