Skip to content

Print

See Also: BasicReport class, Output, Print_Wrap, Subtotal

Purpose

To move data to an image window and to update its subtotal accumulator. This command is only used with legacy style reports that use screen images for output formatting, such as the BasicReport class; most DataFlex reports do not use this technique (or this command).

Syntax

Print {variable} [To {window}] {[format option …, option]}

Window may be omitted where an autopage command is in effect.

What It Does

Print moves variable to window and formats the data according to any format option(s) which are on the command line or a format command addressing window.

print pay.amount

In this example, the value of Field amount in Database File pay is printed to the next autopaged window in the program.

print employee.fica {signrt}

In this example, the value of Field fica in Database File employee is printed to the next autopaged window with a minus sign at the right for negative numbers. You may use the option with or without a window designation, as shown above.

If window is of type Numeric, Integer, or Real, a subtotal accumulator for window will be maintained internally. You may access the value of any subtotal accumulator by appending a percent sign (%) to the name of window. So long as you do not move or calc to the accumulator, this does not zero or otherwise affect the value of the accumulator.

move body.8% to cume

In this example, the subtotal accumulator for the eighth window in Image body is moved to Variable cume.

If a subtotal command anywhere in the program addresses window, the subtotal accumulator for window will be zeroed.

The following are the print format options:

  • capslock
  • fill=
  • float$
  • signrt
  • suppress

Certain output formats may be specified by embedding certain characters among the underscores making up a window:

  • __,__.__ - Comma will embed the thousands' separator in long numbers
  • __C_____C - Will uppercase all lowercase letters
  • __0_____ - Zero will replace blank spaces with zeroes
  • __Z_____Z - Will blank form windows that have a value of zero
  • __@_____ - At will remove leading or trailing spaces
  • __$__.__$ - Will "float" the currency character(s) on the left
  • __*__.__ - Asterisk will replace blank spaces with asterisks

These options apply only to the print command, not to the move command.

Notes

  • Print is the only command that updates subtotal accumulators.
  • You may apply format options to windows by placing them directly on print command lines or by using the format command.
  • DataFlex also uses window-formatting characters directly in data windows in screen images. Except for the C(apslock) letter, they only apply to output using the print command.
  • Print only moves data to a window. Actual output of the window data and surrounding image to the printer or other output device is done by the output_pagecheck command.