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.

  • FIELDS field_name include the specified field or fields

    Fields are included in the order that you list them.

  • FIELDS ALL include all fields in the table

    Fields are included in the order that they appear in the table layout.

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:

  • number the line number, must be between 2 and 60 inclusive
  • field_list the fields to include on that line

TO SCREEN | filename | PRINT

optional

The location to send the results of the command to:

  • SCREEN displays the results in the Analytics display area

    Tip

    You can click any linked result value in the display area to drill down to the associated record or records in the source table.

  • filename saves the results to a file

    Specify filename as a quoted string with the appropriate file extension. For example: TO "Output.TXT"

    By default, the file is saved to the folder containing the Analytics project.

    Use either an absolute or relative file path to save the file to a different, existing folder:

    • TO "C:\Output.TXT"
    • TO "Results\Output.TXT"
  • PRINT sends the results to the default printer

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:

  • FIRST start processing from the first record until the specified number of records is reached
  • NEXT start processing from the currently selected record until the specified number of records is reached

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.