Wednesday 27 August 2008

Feature highlight: Ranges

Introduced in version 1.0.5 of Numberator is a new feature that makes it possible to generate only codes that lie within a user specifiable range. The simplest application of this feature is to control the generation of numerical style codes such as binary, decimal or hexadecimal codes.

For example, when generating four character decimal numerical codes, setting a “from” value of 1255 and a “to” value of 2937 for the range will ensure that all the codes have numerical values of at least 1255 and not more than 2937.

The range feature works in exactly the same way for non-numeric codes. When generating three character alphabetic codes, for example, setting a “from” value of BBC and a “to” value of KAZ will ensure that all the codes that are generated lie between BBC and KAZ.

In the case of non-numeric codes, however, it is not so obvious what “between” actually means. The following rules are therefore useful in determining whether a code lies in a particular range:
  1. Starting with the first character in the code
  2. The code lies in the range if the character lies after the corresponding character of the “from” value and before the corresponding character of the “to” value according to the order in which the characters appear in the allowable characters list. In the example above, the codes CBC, EAZ and JZF satisfy this condition with respect to their first characters and hence lie within the range BBC to KAZ if the allowable character list is ABCDEFGHIJKLMNOPQRSTUVWXYZ.
  3. The code does not lie in the range if the character lies before the corresponding character of the “from” value or after the corresponding character of the “to” value according to the order in which the characters appear in the allowable characters list. In the example above, the codes ABC, LAZ and TZF satisfy this condition with respect to their first characters and hence lie outside the range if the allowable character list is ABCDEFGHIJKLMNOPQRSTUVWXYZ.
  4. If the character is the same as the corresponding character of the “from” or “to” values then repeat the assessments in steps 2 to 4 for the next character in the code (unless the entire code is the same as the "from" or "to" values, in which case it does lie in the range) .
Ranges are an extremely powerful feature and have a wide variety of practical applications. One of the most common is to break a single code generation run up into several mutually exclusive parts, each of which is restricted to its own range.

For example, an on pack promotional campaign might span several different product lines or market segments and generating codes for each line or segment within a certain range makes it possible to control the number codes associated with each as well as to track claim rates.

No comments: