sequence
START
,
INCREMENT

The sequence statement fills every visible cell in the current field with a numeric sequence.


Parameters

This statement has two parameters:

start – the starting value for the sequence.

increment – the amount the value should increase (or decrease) for each record. If this is omitted, it is assumed to be 1.


Description

This statement fills every visible cell in the current field with a numeric sequence (1, 2, 3, etc.).

This example assigns numbers to invoices that don’t have a number yet, starting with 1000.

field  InvoiceNumber
select  sizeof(InvoiceNumber)=0
sequence 1000 ☞ 1000, 1001, 1002, 1003, 1004, …

This example adds a new field for customer number, and automatically assigns numbers to each customer, incrementing by 5.

addfield  CustNumber
fieldtype  "0 digits"
sequence 10,5 ☞  10, 15, 20, 25, 30, 35, …

The increment value doesn’t have to be positve, you can also count down.

sequence 100,-1 ☞ 100, 99, 98, 97, 96, 95, …

If the current field contains floating point numbers, the increment value doesn’t have to be an integer.

sequence 0,0.25 ☞ 0, 0.25, 0.50, 0.75, 1.00, …

If the database contains summary records, the sequence count will reset to the start value after each summary record. If you want to sequence the current field without restarting at summary records, you can use a formulafill command such as

formulafill seq()

or

formulafill Start+(seq()-1)*Increment

Legacy Syntax

In Panorama 6 and earlier, the sequence command used a different syntax. Both the start and increment were combined into a single text parameter, separated by a space. For compatibility with older databases, this syntax is still supported. Here are some examples:

sequence "1" ☞ 1, 2, 3, 4, 5, 6, …
sequence "100" ☞ 100, 101, 102, 103, …
sequence "5 5" ☞ 5, 10, 15, 25, 30, 35, …
sequence "100 -1" ☞  100, 99, 98, 97, 96, 95, … 
sequence "0.1 0.1" ☞ 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, …

See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0, but no longer supports the DIALOG parameter.