JavaScript Editor js editor     Web development 



Main Page

Displays record contents and expression results for the current table in the main Visual FoxPro window or a user-defined window.

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

Parameters

[[FIELDS] FieldList]


Specifies the fields to display. If you omit the FIELDS clause, all fields from the table display by default.
Note:
Memo field contents do not display unless the memo field name is explicitly included in the field list. The displayed width of memo fields is determined by the SET MEMOWIDTH command. For more information, see SET MEMOWIDTH Command.

[Scope]


Specifies a range of records to display. Only those records that fall within the scope range display. The default scope for DISPLAY is the current record (NEXT 1). For more information about scope clauses, see Scope Clauses.
Note:
Commands that include Scope operate only on the table in the active work area.

[FOR lExpression1]


Specifies to display only those records that satisfy the logical condition lExpression1. Expressions can consist of combinations of literals, memory variables, array elements, fields, and memo fields. If lExpression1 can be optimized, Rushmore Query Optimization optimizes a query created with DISPLAYВ ...В FOR. For best performance, use an expression that can be optimized in the FOR clause. For more information, see SET OPTIMIZE Command and Using Rushmore Query Optimization to Speed Data Access.
[WHILE lExpression2]


Specifies a condition to display records as long as the logical expression lExpression2 evaluates to True (.T.).
[OFF]


Suppresses display of record numbers. If you omit OFF, the record number displays preceding each record.
[NOCONSOLE]


Suppresses output to the main Visual FoxPro window or to the active user-defined window.
[NOOPTIMIZE]


Disables Rushmore optimization for DISPLAY. For more information, see SET OPTIMIZE Command and Using Rushmore Query Optimization to Speed Data Access.
[TO PRINTER [PROMPT]


Directs output from DISPLAY to a printer. The PROMPT keyword specifies to display a Print dialog box before printing starts. The printer settings that you can adjust depend on the currently installed printer driver.
TO FILE FileName [ADDITIVE]]


Directs output from DISPLAY to the file specified with FileName. If the file already exists, and SET SAFETY is ON, Visual FoxPro prompts you to choose whether to overwrite the file. The ADDITIVE keyword appends output to the end of the specified file. If you omit ADDITIVE, Visual FoxPro overwrites the file with the value of the expression.

Remarks

DISPLAY is similar to the LIST command except that DISPLAY displays information one screen at a time and pauses between screens. LIST displays the same information without pausing. To view the next screen, press any key or click anywhere in the Visual FoxPro window. For more information, see LIST Commands.

Tip:
To display field names and expressions, set the SET HEADINGS command to ON. For more information, see SET HEADINGS Command.

DISPLAY shows data for Varbinary fields in hexadecimal format and is limited to 256 characters, which includes the prefix 0h and 127 hexadecimal encoded bytes. For more information, see Varbinary Data Type.

Example

The following example opens the Visual FoxPro sample database, TestData.dbc, using the OPEN DATABASE command and the Customer table using the USE command. The example clears the main Visual FoxPro window using the CLEAR command and displays the contents of the first record using the DISPLAY command.

В Copy Code
CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\TestData')
USE Customer  
CLEAR
DISPLAY FIELD cust_id, company, contact OFF NEXT 10

See Also



JavaScript Editor js editor     Web development