Share via


DISPLAY Command

Displays information about the current table in the main Visual FoxPro window or in the user-defined window.

DISPLAY [[FIELDS] FieldList] [Scope] [FOR lExpression1] 
   [WHILE lExpression2] [OFF] [NOCONSOLE] [NOOPTIMIZE] 
   [TO PRINTER [PROMPT] | TO FILE FileName]

Parameters

  • FIELDS FieldList
    Specifies the fields to display. If you omit FIELDS FieldList, all fields from the table are displayed by default.

    Memo field contents aren't displayed unless the memo field name is explicitly included in the field list. The displayed width of memo fields is determined by SET MEMOWIDTH.

  • Scope
    Specifies the range of records to display. Only the records that fall within the range are displayed. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. Commands that include Scope operate only on the table in the active work area.

    For more information on scope clauses, see the Scope Clauses online topic.

    The default scope for DISPLAY is the current record (NEXT 1).

  • FOR lExpression1
    Specifies that only the records that satisfy the logical condition lExpression1 are displayed. This makes it possible for you to filter out undesired records.

    Rushmore optimizes a query created with DISPLAY ... FOR if lExpression1 is an optimizable expression. For best performance, use an optimizable expression in the FOR clause.

    For more information, see SET OPTIMIZE and Using Rushmore to Speed Data Access.

  • WHILE lExpression2
    Specifies a condition whereby records are displayed for as long as the logical expression lExpression2 evaluates to true (.T.).

  • OFF
    Suppresses the display of record numbers. If you omit OFF, the record number is displayed before each record.

  • NOCONSOLE
    Suppresses output to the main Visual FoxPro window or to the active user-defined window.

  • NOOPTIMIZE
    Disables Rushmore optimization of DISPLAY.

    For more information, see SET OPTIMIZE and Using Rushmore to Speed Data Access.

  • TO PRINTER [PROMPT]
    Directs output from DISPLAY to a printer.

    In Visual FoxPro you can include the optional PROMPT clause to display a dialog box before printing starts. In this dialog box, you can adjust printer settings, including the number of copies and page numbers to print. The printer settings that you can adjust depend on the currently installed printer driver. Place PROMPT immediately after TO PRINTER.

  • TO FILE FileName
    Directs output from DISPLAY to the file specified with FileName. If the file already exists and SET SAFETY is ON, you are asked if you want to overwrite the file.

Remarks

DISPLAY displays the contents of records and the results of expressions for the current table. If there is more information than can be displayed in the window, the first screen of information is displayed and Visual FoxPro pauses. Press any key or click anywhere to see the next screen of information. DISPLAY is similar to LIST, except that LIST displays the same information in a continuous stream without pausing.

DISPLAY can also be used to display the results of expressions, which can consist of combinations of literals, memory variables, array elements, fields, and memo fields. Field names and expressions are displayed if SET HEADINGS is ON.

Example

The following example opens the customer table in the testdata database. The contents of the first record are displayed.

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE customer  && Opens Customer table

CLEAR
DISPLAY FIELD cust_id, company, contact OFF NEXT 10

See Also

LIST | SET HEADINGS | SET MEMOWIDTH