Partager via


Setting Each Control's Print Options

You can control when and how often each report control is printed in your report. For more information about a control's print options, see Print When Dialog Box.

Suppressing Repeated Values

For field controls, you can suppress values repeated for consecutive records so that the value is printed once for the first record but doesn't appear for subsequent records until the value changes. For example, if you're printing an invoice, and one of the fields contains the date of the transaction, the date would only be printed once for transactions that took place on the same date.

To suppress repeated values

  1. Double-click the control to display the control's dialog box.
  2. Choose Print When to display the Print When dialog box.
  3. In the Print Repeated Values area, select No, and then choose OK.

To repeat only on a new page or column

  1. Double-click the control.
  2. Choose Print When.
  3. In the Print repeated values area, select No.
  4. In the Also print area, select In first whole band of new page/column, and then choose OK.

To repeat when the detail band overflows to a new page or column

  1. Double-click the control.
  2. Choose Print When.
  3. In the Also Print area, select When detail overflows to new page/column, and then choose OK.

Building Print Expressions

You can add expressions to a control: they are evaluated before the field prints. If the expression evaluates to false (.F.), the field will not print. If you add an expression, all of the other options in the Print When dialog box are disabled except Remove Line If Blank.

For examples of Print When conditions, see the reports Colors.frx and Ledger.frx in the Visual FoxPro \Samples\Solution\Reports directory.

To add a print expression

  1. Double-click the control.

  2. Choose Print When.

  3. In the Print only when expression is true box, enter an expression.

    -or-

    Click the dialog button to create an expression with the Expression Builder.

Suppressing Blank Lines

Your report may include records that don't contain values for every field control. By default, Visual FoxPro leaves the area for that field blank. You can remove these blank areas to create a more pleasing and continuous display of the information.

To suppress blank lines

  1. Double-click the control that's likely to cause blank lines in the report.
  2. Choose Print When.
  3. Select Remove line if blank.

Visual FoxPro will remove the line from the report if it evaluates to blank. If the field doesn't print or if the table field is empty, Visual FoxPro checks for other controls in the line. If none are found, the line is removed. If you don't select this option and no other controls are on the same line, a blank line is printed.

See Also

Setting Print Options for Controls | Setting Print Options for Groups | Adding Reports and Labels | SELECT - SQL