Compartilhar via


How to: Create RDLC Reports

To create a client report definition (RDLC) report, you:

  • Create a blank report and use Report Dataset Designer to add items to the dataset.

  • Use Visual Studio Report Designer to design the layout of the report.

To create a blank report and add items to the dataset

  1. In the development environment, on the Tools menu, choose Object Designer.

  2. In Object Designer, choose Report, and then choose New.

  3. In Report Dataset Designer, the first line contains DataItem in the Data Type column. In the Data Source column, either enter a table name or table number, or choose the Assist button to select a table from the table list.

  4. In the Name field of the DataItem line, either enter a name or verify the default name. The name must be a Common Language Specification (CLS)–compliant name. For more information, see the "Naming" section in Common Language Specification in the MSDN Library.

  5. In Report Dataset Designer, on the first blank line, in the Data Type column, select Column from the drop-down list.

  6. In the View menu, choose Field Menu.

    The Field Menu window opens, displaying the list of available fields from the data item.

  7. In the Field Menu window, select one or more fields that you want to add to the report dataset. Select multiple fields by holding down the SHIFT key or the CTRL key. Choose the OK button to add the selected fields to the dataset.

  8. If you want to include the caption of a column in the dataset, then select the Include Caption check box in Report Dataset Designer. The caption is included as a parameter in Visual Studio Report Designer.

    Note

    If the Include Caption column is not visible in Report Dataset Designer, then on the View menu, choose Show Column, select Include Caption, and then choose the OK button.

  9. In Report Dataset Designer, enter data items and columns until you have added all fields from all the tables that you want to include in the report.

  10. If you want to add a label to the report, such as a caption for a table header or a title for the report, then add a label to the dataset. For more information, see How to: Create Labels for a Report.

  11. If you want to include a variable in the report dataset, then do the following:

    1. In Report Dataset Designer, on a blank line, in the Data Type column, select Column from the drop-down list.

    2. In the Data Source column, enter the variable. You can use the up arrow to open the C/AL Symbol Menu dialog box and view the variables for the report.

    3. In Report Dataset Designer, in the Name column, enter a CLS-compliant name for the variable. This name is used in the dataset in Visual Studio.

  12. If you want to include a calculation or other source expression in the report dataset, then do the following:

    1. In Report Dataset Designer, on a blank line, in the Data Type column, select Column from the drop-down list.

    2. In the Data Source column, enter the source expression, such as 8*125.

    3. In the Name column, enter a CLS-compliant name for the variable. This name is used in the dataset in Visual Studio.

  13. On the File menu, choose Save.

  14. In the Save As dialog box, in the ID field, enter an ID for the report object. The ID must be in a valid range for your solution. In the Name field, enter a name for the report. Select the Compiled check box, and then choose OK.

To design the report layout

  1. On the View menu, choose Layout.

    Visual Studio opens. The dataset in Visual Studio contains the dataset items that you added in Report Dataset Designer.

  2. Use Visual Studio Report Designer to add items from the dataset to the report and design the layout of the report. For more information, see Defining a Report Layout (Visual Studio Report Designer).

  3. In Visual Studio, on the File menu, choose Save report.rdlc, and then close Visual Studio.

  4. In Report Dataset Designer, select a new row. A dialog box shows the following message:

    The layout of report id: '<report ID>' is changed by another application.

    Filename of the changed RDLC: ‘<filename>

    Do you want to load the changes?

  5. In the dialog box, choose Yes to load the changes that you made to the RDLC layout into the report.

  6. In the development environment, on the File menu, choose Save.

  7. In the Save dialog box, select Compiled, and then choose OK.

  8. To run the new report, in Object Designer, select the report and then choose Run.

See Also

Concepts

Designing, Running, and Printing Reports