SEQUENCE command
Determines if one or more fields in an Analytics table are in sequential order, and identifies out-of-sequence items.
Syntax
SEQUENCE <ON> {<FIELDS> field <D> <...n>|<FIELDS> ALL} <UNFORMATTED> <ERRORLIMIT n> <IF test> <WHILE test> <FIRST range|NEXT range> <TO {SCREEN|filename|PRINT}> <APPEND> <HEADER header_text> <FOOTER footer_text> <PRESORT> <LOCAL> <ISOLOCALE locale_code>
Parameters
Name | Description |
---|---|
ON FIELDS field D <...n> | FIELDS ALL |
The fields or expressions to check for sequential order. Specify ALL to check all fields in the Analytics table. Include D to sort the key field in descending order. The default sort order is ascending. |
UNFORMATTED optional |
Suppresses page headings and page breaks when the results are output to a file. |
ERRORLIMIT n optional |
The number of errors allowed before the command is terminated. The default value is 10. |
IF test optional |
A conditional expression that must be true in order to process each record. The command is executed on only those records that satisfy the condition. Note The IF parameter is evaluated against only the records remaining in a table after any scope parameters have been applied (WHILE, FIRST, NEXT). |
WHILE test optional |
A conditional expression that must be true in order to process each record. The command is executed until the condition evaluates as false, or the end of the table is reached. Note If you use WHILE in conjunction with FIRST or NEXT, record processing stops as soon as one limit is reached. |
FIRST range | NEXT range optional |
The number of records to process:
Use range to specify the number of records to process. If you omit FIRST and NEXT, all records are processed by default. |
TO SCREEN | filename | PRINT optional |
The location to send the results of the command to:
|
APPEND optional |
Appends the command output to the end of an existing file instead of overwriting it. Note You must ensure that the structure of the command output and the existing file are identical:
Analytics appends output to an existing file regardless of its structure. If the structure of the output and the existing file do not match, jumbled, missing, or inaccurate data can result. |
HEADER header_text optional |
The text to insert at the top of each page of a report. header_text must be specified as a quoted string. The value overrides the Analytics HEADER system variable. |
FOOTER footer_text optional |
The text to insert at the bottom of each page of a report. footer_text must be specified as a quoted string. The value overrides the Analytics FOOTER system variable. |
PRESORT optional |
Sorts the table on the key field before executing the command. Note You cannot use PRESORT inside the GROUP command. |
LOCAL optional |
Saves the output file in the same location as the Analytics project. Note Applicable only when running the command against a server table with an output file that is an Analytics table. |
ISOLOCALE locale_code optional |
Note Applicable in the Unicode edition of Analytics only. The system locale in the format language_country. For example, to use Canadian French, enter fr_ca. Use the following codes:
If you do not use ISOLOCALE, the default system locale is used. |
Analytics output variables
Name | Contains |
---|---|
WRITEn |
The total number of sequence errors identified by the command. |
Examples
Testing for out of sequence employee IDs and hire dates
You write any sequence errors identified in the EmployeeID and HireDate fields to a text file:
SEQUENCE ON EmployeeID HireDate ERRORLIMIT 10 TO "SequenceErrors.txt"
Remarks
Using SEQUENCE inside a GROUP
If you use SEQUENCE inside a GROUP command, the command executes to avoid interfering with the processing of the group, but no further data sequence errors are reported.