List records to the console
LIST <exp list> [TO PRINTER] [TO FILE <xcFile>] [<scope>] [WHILE <lCondition>] [FOR <lCondition>] [OFF]
<exp list> is the list of expressions to be evaluated and displayed for each record processed.
TO PRINTER echoes output to the printer.
TO FILE <xcFile> echoes output to the specified file name and can be specified either as a literal file name or as a character expression enclosed in parentheses. If an extension is not specified, .txt is added.
<scope> is the portion of the current database file to LIST. The default is ALL records.
WHILE <lCondition> specifies the set of records meeting the condition from the current record until the condition fails.
FOR <lCondition> specifies the conditional set of records to LIST within the given scope.
OFF suppresses the display of record numbers.
LIST is a console command that sequentially accesses records in the current work area, displaying the results of one or more expressions for each record accessed. The output is in tabular format with each column separated by a space. LIST is identical to DISPLAY with the exception that its default scope is ALL rather than NEXT 1.
When invoked, output is sent to the screen and, optionally, to the printer and/or a file. To suppress output to the screen while printing or echoing output to a file, SET CONSOLE OFF before the LIST invocation.
. Interrupting LIST: So the user may interrupt a LIST, use INKEY() as part of the FOR condition to test for an interrupt key press. See the example below.
. Printer margin: LIST honors the current SET MARGIN for output echoed to the printer.
. In this example, a simple list is followed by a conditional list to the printer: USE Sales LIST DATE(), TIME(), Branch LIST Branch, Salesman FOR Amount > 500 TO PRINTER . This example interrupts LIST using INKEY() to test whether the user pressed the Esc key: #define K_ESC 27 USE Sales INDEX Salesman NEW LIST Branch, Salesman, Amount WHILE INKEY() != K_ESC