Command @...SAY Foundation

Output data on the screen or to the printer.

Syntax
@ <nRow>, <nCol> SAY <SayExpr> ;
            [PICTURE <cSayPicture>] ;
              [COLOR <cColor>]
Parameters
<nRow>
<nRow> is a numeric value specifying the row position at which the value of <SayExpr> is displayed or printed.
<nCol>
<nCol> is a numeric value specifying the column position at which the value of <SayExpr> is displayed or printed.
<SayExpr>
<SayExpr> is an expression of any data type that is output at the coordinates <nRow> and <nCol>. When the PICTURE option is specified, the value of <SayExpr> is formatted according to the picture format <cSayPicture>. When <SayExpr> is an object or a code block, a Null string ("") is output.
<cSayPicture>
<cSayPicture> is a character string containing a picture format. This optional argument determines the format for the output of <SayExpr> (see below).
<cColor>
<cColor> is a character string specifying the color in which <SayExpr> is displayed. If no color value is specified, the default color (first color value) of the system colors set with SetColor() is used.
Description

The command @...SAY outputs the value of <SayExpr> on the current output device. Normally this is the screen. When the command SET DEVICE TO PRINTER is called prior to @...SAY, the output occurs to the printer. Simultaneous output to the screen and printer (which is possible with the command ?|??) does not occur with @...SAY. Also, the command SET CONSOLE ON | OFF does not have an effect on the output to the screen.

The value of <SayExpr> can be of any data type.

Objects and code blocks cannot be output.

The PICTURE option specifies a PICTURE format used to format the output value. A PICTURE format is a character string which can consist of two parts: the format function and the format mask.

The PICTURE formatting function

The format function always appears at the beginning of a PICTURE format and is prefixed with the character @ (Chr(64)). One or more characters from the following table follow this character. Each of the characters specified following @ stand for a specific formatting rule used in the display of<SayExpr>. A PICTURE format can consist only of one formatting function. If a format mask is also specified to format each individual character of <SayExpr>, this mask must appear after the formatting function and must be separated from it by a single blank space (Chr(32)).

Characters for the PICTURE function with @...SAY
Character Data type Formatting rule
B N Displays number left justified
C N Displays "CR" (Credit) after positive numbers
D C Displays character strings in SET DATE format
L<c> N Fills numeric values from the left with the character <c>
R C Inserts characters which are not mask characters
X N Displays "DB" (Debit) after negative numbers
Z N Only blank spaces are displayed when the value is 0
( N Displays negative numbers in parentheses with leading blank spaces
) N Displays negative numbers in parentheses without leading blank spaces
$ N Places the country specific currency character in front of a number
! C Converts letter characters to upper case

The PICTURE formatting mask

The formatting mask is a character string whose individual characters define rules for formatting individual characters of <SayExpr>during display. The characters from the following table are interpreted as formatting characters. Any other characters contained in the PICTURE mask are displayed at the corresponding position. If the PICTURE format contains the formatting function @R, the unknown formatting characters are inserted into the display. If @R is missing, the corresponding characters are overwritten in the display of <SayExpr>. The formatting mask can be specified in the PICTURE format along with the formatting function. If both are used, the formatting function must appear first and be separated from the formatting mask by a single blank space.

Characters for the PICTURE mask with @...SAY
Characters Formatting rule
A,N,X,9,# Displays character for each data type
L Displays logical values as "T" or "F"
Y *) Displays logical values as "Y","J" or "N"
! Converts lower case letters to upper case
$ Replaces leading blank spaces of numbers with a dollar sign ($)
* Replaces leading blank spaces of numbers with an asterisk (*)
. Marks position for a decimal point
, Marks position for a comma
  1. The display is country specific

Output on the screen

The formatted value of <SayExpr> is displayed on the screen by default. The display color is either the color value specified in the option COLOR or is the default color of SetColor(). The display occurs at the coordinates <nRow> and <nCol> and after the display, the values of the functions Row() and Col() are updated. The cursor appears immediately after the last output character. When characters extend past the screen margin, the cursor position is outside of the visible display area.

Output to the printer

The command SET DEVICE TO PRINTER redirects output from @...SAY to the printer. Prior to output, the print head is moved to the coordinates <nRow> and <nCol>. Then the characters of <SayExpr> are sent to the printer and the function values of the functions PRow() and PCol() are updated to correspond with the new print head position. If the value for <nRow> is less the internal row counter of the function PRow(), an automatic form feed occurs before the output (similar to the EJECT command). The print head is then positioned at the start of the page. When the value of <nCol> is less than the internal column counter of the function PCol(), the print head is automatically positioned at the next row prior to output. This automatic behavior can be suppressed by setting the internal counters of PRow() and PCol() to appropriate values with the function SetPrc() before output.

When a left page margin is set with the command SET MARGIN TO, the specified number of characters is added to the value of <nCol>.

The output with @...SAY can be sent to a file if the output device is set with SET DEVICE TO PRINTER and the print output is redirected to a file using SET PRINTER TO <cFileName>.

Examples
@...SAY
// In the example, formatted data from a customer file is 
// displayed on the screen. 

#include "Inkey.ch" 

PROCEDURE Main 
   USE Customer ALIAS Cust NEW 

   DO WHILE LastKey() <> K_ESC .AND. .NOT. Eof() 

      @ 5, 1 SAY "First name:  " 
      @ Row(),Col() SAY Cust->FName ; 
                PICTURE "@!" 

      @ 6, 1 SAY "Last Name: " 
      @ Row(),Col() SAY Cust->LName ; 
                PICTURE "@!" 

      @ 7, 1 SAY "Telephone:  " 
      @ Row(),Col() SAY Cust->Phone ; 
                PICTURE "@R (999) 999-9999" 

      Inkey(0) 

      IF LastKey() == K_UP 
         SKIP -1 
      ELSE 
         SKIP 
      ENDIF 
   ENDDO 

   CLOSE Cust 
RETURN 
Feedback

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.