DISPLAY

DISPLAY

Display records to the console

Syntax

      DISPLAY <exp list>
             [TO PRINTER] [TO FILE <xcFile>]
             [<scope>] [WHILE <lCondition>]
             [FOR <lCondition>] [OFF]

Arguments

<exp list> is the list of values to display for each record processed.

TO PRINTER echoes output to the printer.

TO FILE <xcFile> echoes output to the indicated file which 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 DISPLAY. The default is the current record, or NEXT 1. If a condition is specified, the scope becomes ALL.

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 DISPLAY within the given scope.

OFF suppresses the display of the record number.

Description

DISPLAY is a database command that sequentially accesses records in the current work area, sending the results of the <exp list> to the console in a tabular format with each column separated by a space. The command does not display column headers or pause at predetermined intervals. DISPLAY is identical to LIST with the exception that its default scope is NEXT 1 rather than ALL.

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 DISPLAY command line.

Notes

. Interrupting output: To let the user interrupt the processing of a DISPLAY command, using the INKEY() function, add a test for the interrupt key press to the FOR condition. See the example below. . Printer margin: Since DISPLAY is a console command, it honors the current SET MARGIN for output echoed to the printer.

Examples

      .  This example illustrates a simple DISPLAY, and a conditional
      DISPLAY to the printer:
      USE Sales NEW
      DISPLAY DATE(), TIME(), Branch
      DISPLAY Branch, Salesman FOR Amount > 500 TO PRINTER
      .  This example interrupts a DISPLAY using INKEY() to test
      whether the user pressed the Esc key:
      #define K_ESC  27
      USE Sales INDEX SalesMan NEW
      DISPLAY Branch, Salesman, Amount WHILE ;
         INKEY() != K_ESC

Seealso

DBEVAL(), INKEY(), LIST, SET MARGIN

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s