Command DISPLAY Foundation

Outputs records and/or displays them on the screen.

DISPLAY <Expression,...> ;
   [FOR    <lForCondition>] ;
   [WHILE  <lWhileCondition>] ;
   [NEXT   <nCount>] ;
   [RECORD <xRecordID>] ;
   [TO FILE <cFilename>] ;
   [REST] ;
   [ALL] ;
<Expression,...> is a comma-separated list of expressions output for each record in the current work area.
<lForCondition> is an optional logical expression defining a condition. The expressions in the list <Expression,...> are only displayed when <lForCondition> returns the value .T. (true).
<lWhileCondition> is an optional logical expression defining a condition. The expressions in the list <Expression,...> are displayed only as long as <lWhileCondition> returns the value .T. (true). As soon the expression returns .F. (false), the procedure terminates.
<nCount> optionally specifies the number of records displayed, starting with the current record. The default setting is NEXT 1.
<xRecordID> is an optional record ID (for DBF files, it is the record number). If it is included, only the specified record is displayed.
FILE <cFilename>
<cFilename> specifies the name of the file into which the data is also written. The name must contain the drive and path if they are necessary. The file can be specified either as a literal file name or as a character expression in parentheses. When the file name is specified without file extension, ".TXT" is used by default.
The option TO PRINTER specifies that the output should also be sent to the printer.
The option REST indicates that records are displayed only from the current to the last record. If a condition is specified, the option ALL is the default value.
The option ALL indicates that all records from the work area are displayed. If a condition is specified, this condition is tested for all records. Contrary to many other commands, the option ALL is not the default setting for the command DISPLAY.
If the option OFF is specified, the record ID is not output. For DBF files, the record ID is the record number (RecNo()).

The command DISPLAY outputs the values of the expression list <Expression,...> in table form. The values are separated by blank spaces. DISPLAY does not display any column headings and sequentially processes the records in the current work area. The result of the expression list is output for each record matching the condition up to the specified record count. DISPLAY differs from many other commands in that the default scope is NEXT 1, not ALL. During the output of records, the display is not paused, but continues scrolling. DISPLAY is identical to the command LIST except for the default scope of records. The default for LIST is ALL.

The command DISPLAY outputs the values of <Expression,...> to the screen. The output can also be sent to the printer or to a file using the options TO PRINTER or TO FILE. To suppress the screen output, the command SET CONSOLE OFF must be called before call to DISPLAY.

records with deletion flags are only output when SET DELETED is turned OFF. In this case, the deletion flag is identified with an asterisk (*) in the output.

// The example shows a simple listing of records 
// from an invoice file. The output occurs on the screen 
// and the printer. 

   USE Invoice NEW 

   DISPLAY "Unpaid invoices", Date(), Time() TO PRINTER 
   DISPLAY InvDate, PartNo, Payment TO PRINTER ; 
           FOR Payment == 0 

Pausing the output of DISPLAY
// The example shows how the screen display can be paused 
// after each MaxRow() rows are output and how the option to terminate 
// output using the Esc key can be implemented. 

#include "" 

   LOCAL nCount := 0 
   USE Customer NEW 

   DISPLAY LName, FName, Phone ; 
     WHILE IIf( ++nCount % MaxRow()==0, Inkey(0)<>K_ESC, .T. ) 


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.