Partager via


How to: Add Field Controls to Reports

Field controls are how you render data from variables, expressions, and fields in tables and views on a report or label. These values can change for each record traversed by the report engine as it processes the report.

If your report layout has an accompanying data environment, you can add fields from tables and views directly from the report's data environment.

To add a Field control to the page

  1. Open the report or label in the appropriate designer.

  2. On the Report menu, point to Insert Control, and click Field.

    The Field Properties dialog box opens.

    Tip

    You can also double-click the report control in the Report Designer or Label Designer to open the report control properties dialog box.

    Note

    If the _REPORTBUILDER system variable is not set to the default Report Builder or is set to a third-party builder, the Report Expression dialog box displays or a different dialog box might display. For more information, see _REPORTBUILDER System Variable and Report Expression Dialog Box.

  3. In the Field Properties dialog box, click the General tab if it is not selected.

  4. In the Expression box, type the expression, variable, or table field you want. To build an expression, click the ellipsis () button to open the Expression Builder.

  5. When you are finished in the Expression Builder, click OK.

  6. In the Field Properties dialog box, specify the formatting settings that you want, and click OK.

    Tip

    To specify that the bottom of the Field report control expands to fit the results of the expression when the control is populated, click Stretch with overflow.

    A Field control for the variable, expression, or field appears in the Page Header report band by default.

    Tip

    You can add Field report controls at the position you want by selecting them on the Report Controls toolbar and drawing them. When you specify an expression in a Field report control, resize the Field report control to the minimum amount of space the expression requires. If more space is needed, you can set the control to stretch for larger values, but you cannot set it to reduce in size if less space is needed.

For more information, see How to: Specify Expressions in Field Controls, General Tab, Report Control Properties Dialog Box (Report Builder), and Expression Builder Dialog Box.

You can also specify the data types and output format options for the values stored in the Field control. For more information, see How to: Specify Data Types for Field Controls.

To add a Field control from the data environment directly

  1. Open the report or label in the appropriate designer.

  2. On the View menu, click Data Environment to open the data environment for the report.

  3. Drag the field you want from the table or view to the position you want in the designer.

    A Field report control for the field appears in the Page Header band by default. After you add the control, you can move it by dragging it to the position you want.

See Also

Other Resources

Managing Report Controls
Configuring Report Controls
Adding Report Controls
Working with Report Controls