Counters tab

The counters tab of the database properties window is where you define all counters. Counters are used for automatically numbering records.

The three columns are:

  • Name: Name the counter based on the kind of record it is used for, like "job". The name does not have to match anything.
  • Value: This is the seed value, usually zero, but you can start at any number you want.
  • Expression: (optional) Enter a display expression, that is used to format the value. This is only useful if the auto-numbering field is a string. Use the term $value in the expression to refer to the value. (Examples below)

Hooking up a property to a counter

There are three separate things that have to be set to make the connection between a property of a record and a counter.

  • Create the counter as described above.
  • Create a Display type that references the counter, and usually has the same name as the counter, or may be named something like "job counter".
  • Open the property of the record type and set its display type to the display type created in the previous step.

If you plan in advance, it is easier to create counters, then display types, then record types.

Every time you edit a record in a list, if the auto-number property (the one connected to the counter) is empty, the counter is activated, and the next value is applied. No matter how many users are entering records at a time, the values will be unique.

By the way, you can export and import counters because they are records just like any other record.

Using counters with string fields

For numeric fields, the counter is normally used without an expression, and the number is incremented and copied over each time you create a record.

If you use a string field, it could be that you want a numbering system that is more complicated, like CR00032, CR00033, etc. or some other formatting requirement. To do this, use an expression such as this example:

"CR" ($value) [00000])

The term $value is replaced by the counter value (type int64). The formatting term [00000] means to format the value with five digits. If the value was 6, the expression would yield CR00006.

(c) 2014-2015 Divergent Labs, Inc.