7.1
2013-09-23

COUNTER

Syntax

COUNTER([Start value][,End value] [,Step size] [,Number of positions] [,Leading zeroes])

Description

A counter which by default counts from the first to the last record. Arguments are optional.

Example

COUNTER (1,100)

COUNTER (1,100, 5, 3, True)

COUNTER (1, 100, 0.5, 3, False)

Parameter description

Start value

The start value of the counter. Default 1 .

End value

The end value of the counter. If no value is specified, the counter is never reset and will go until the end

Step size

The step size to the next number. Default 1.

Number of positions

The number of characters the counter will create. By default no extra characters will be added. Default 0.

Leading zeroes

True for leading zeroes, False for no leading zeroes (default).

You can use a counter when printing tickets or numbering your mailing. You do not need to open a database within PrintShop Mail when using a COUNTER, if this is the only variable.

Example 1

The first example creates numbers, starting with 1 and ending with 100.

Code:

COUNTER (1,100)

Result:

1, 2, 3, 4, [...] , 99, 100, 1, 2, 3, [...]

The counter restarts once it has reached the end, in this case 100.

Example 2

The Second example has a step of 5, meaning it will only display every 5th number. The parameters step size, number of positions and leading zeroes have been added.

Code: 

COUNTER (5,100, 5, 3, True)

Result: 

005, 010, 015, [...] , 090, 100, 005, 010, [...]

Example 3

The third example has a fraction for the step size. This means that the counter increases by 0.5.

Code: 

COUNTER (1, 100, 0.5, 3, False)

Result:

1, 1.5, 2, 2.5, 3, [...] , 99.5, 100, 100.5, [...]

Example 4

The last example, COUNTER() starts with 1 and ends at whatever number is set in Items without database (Program settings in the Preferences).