Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.
This form of DISPLAY and LIST
shows data from the table open in the current work area.
DISPLAY | LIST [ FIELDS ] uExpressionList
[ Scope ] [ FOR lForExpression ]
[ WHILE lWhileExpression ]
[ OFF ]
[ TO PRINT [ PROMPT ] | TO [ FILE ] cFileName ]
[ NOCONSOLE ]
[ NOOPTIMIZE ]
These are very old commands. They’ve added a few new clauses along the way, but the basics date back to the beginnings of Xbase history.
These are most useful for checking out data interactively. When you’re trying to figure out what went wrong or you need a quick-and-dirty list to send someone, DISPLAY and LIST
give you a fast way to get the information out.
uExpressionList can contain any expression at all. Most typically, you have either fields of the current table or expressions based on those fields. If the current table is the parent of a temporal relation, you might also include fields from the related table. (If you specify fields in unrelated tables, you’ll see the same values for fields in the non-selected table for each record in the selected table, because there is nothing within this command to move the record pointer in the unselected table.) Similarly, a constant or UDF can be used in the expression list to produce an output column not available from the source table.
By default, these commands include the record number as the first item in the listing. OFF gets rid of the record number. SET HEADING controls the field and function names at the top of the list.
It’s hard to imagine a situation where NOOPTIMIZE would be relevant to DISPLAY or LIST, but since they do have a FOR clause and they are sensitive to SET FILTER
, we guess NOOPTIMIZE was needed for completeness. Check out SET OPTIMIZE
if you care.
USE Customer
DISPLAY Customer_Id, Company_Name
LIST Customer_Id, Company_Name TO PRINT OFF