LIST command
Outputs the data in one or more fields in an Analytics table to a display formatted in columns.
Syntax
LIST {FIELDS field_name <AS display_name> <...n>|FIELDS ALL} <LINE number field_list> <TO {SCREEN|filename|PRINT}> <UNFORMATTED> <IF test> <WHILE test> <FIRST range|NEXT range> <HEADER header_text> <FOOTER footer_text> <SKIP lines> <EOF> <APPEND>
Parameters
Name | Description |
---|---|
FIELDS field_name <...n> | FIELDS ALL |
The fields to include in the output.
|
AS display_name optional |
Only used when listing data using FIELDS field_name. The display name (alternate column title) for the field in the output. If you want the display name to be the same as the field name, or an existing display name in the source table, do not use AS. Specify display_name as a quoted string. Use a semi-colon (;) between words if you want a line break in the column title. |
LINE number field_list optional |
More than one line is used in the output for each record:
|
TO SCREEN | filename | PRINT optional |
The location to send the results of the command to:
|
UNFORMATTED optional |
The output is displayed as unformatted text. Output is identical to that created by the EXPORT ASCII command. Unformatted data can be output to a file for further processing by other software programs. |
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. |
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. |
SKIP lines optional |
Inserts the specified number of blank lines between each record in the list. For example, LIST ALL SKIP 1 produces a double spaced list (one blank line between each record). |
EOF optional |
Execute the command one more time after the end of the file has been reached. This ensures that the final record in the table is processed when inside a GROUP command. Only use EOF if all fields are computed fields referring to earlier records. |
APPEND optional |
Appends the command output to the end of an existing file instead of overwriting it. |
Examples
Listing exceptions and saving to a text file
You use LIST to create a report listing exceptions identified in an inventory table. The report is saved as a text file:
LIST Product_number Description Quantity Unit_cost Value IF Quantity < 0 OR Unit_cost < 0 HEADER "Negative Values" TO "Exceptions.txt"
Remarks
When to use LIST
Use LIST to print data, display data on screen, or export it to a text file.
Formatting and totals
Unless you specify UNFORMATTED, the following information is included automatically:
- page numbers
- date
- time
- user identification
- column headings
Numeric columns are also automatically totaled.