Generate Sequence
Overview
The Generate Sequence tool produces a series of numbers starting at a user-defined Start Value and ending with the user-defined End Value. The sequence can be ascending or descending, it can repeat, and it can proceed by any increment. You might use the Generate Sequence tool when:
You are loading a database with a new record set, and need to give each record a unique key (see Creating a unique ID).
Your project sends records through several processing paths, and needs to track each record uniquely so that all paths can be correctly recombined. This is often a requirement of merge/purge or householding projects (see Merge/purging a set of mailing lists).
You are processing your data using tools that change the ordering (such as Unique or Summarize), but you want to recover the original record order at the output. You would generate a unique number for each record, send the records through the project, and then Sort the records by unique ID at the end of the process.
In all these applications, you attach the new ID to a record from some source, thus "tagging" the record with an extra field. To do this, connect both your input source and the Generate Sequence tool to a Select tool.
Examples:
Sequence to generate | Start Value | End Value | Step By | Repeat? |
Even numbers from 0 to 1000 | 0 | 1000 | 2 | N |
Odd numbers from 1 to 1000 | 1 | 1000 | 2 | N |
Numbers from 1 to 100, repeating forever | 1 | 100 | 1 | Y |
Count down from 1000 to -1000 | 1000 | -1000 | 1 | N |
Generate Sequence tool configuration parameters
The Generate Sequence tool has a single set of configuration parameters in addition to the standard execution options.
Parameter | Description |
---|---|
Field name | Name of the output field. This is optional and defaults to ID. |
Start value | Starting value for the sequence. This is optional and defaults to 0. |
End value | Ending value for the sequence. This is optional and defaults to 1000. |
Step by | Amount to add to the sequence value at each step. This is optional and defaults to 1. |
Repeat after the end value is reached | If selected, the sequence will repeat after End value is reached. |
Configure the Generate Sequence tool
Select the Generate Sequence tool.
Go to the Configuration tab on the Properties pane.
Enter the desired name in the Field name box. The default name is “ID”.
Specify a Start value. The default value is “1”.
Specify an End value. The default value is “1000”.
Specify a Step by value. The default value is 1. Specify a negative number to count down from a higher Start value to a lower End value.
Optionally, select Repeat after end value is reached to repeat the sequence defined by the Start Value and End Value. If this is selected, the tool produces an infinite number of records; use a First N or Select tool to limit the output.
Optionally, go to the Execution tab, and then set Web service options.