[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Collapse]Report and Dashboard Server
 [Expand]Installation
  License and Distribution
 [Expand]Administrative Panel
 [Collapse]Create Reports
  [Collapse]Web Report Designer
    Create and Customize Reports
    Bind a Report to Data
    Construct the Report Layout
    Calculate Custom Values
    Specify Data Formatting
    Customize the Report Appearance
    Apply Conditional Formatting
    Sort and Group Report Data
    Calculate a Summary
    Add Additional Information
    Add Parameters and Filter Data
    Provide Navigation to the Report
    Provide Interactivity to the Report
  [Expand]Windows Forms Report Designer
 [Expand]Create Dashboards
 [Expand]Configuration and API
  User-Specific Functions
  Localization
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Bind a Report to Data

This tutorial demonstrates how to bind a report to a hierarchical data source and specify a master-detail relationship between data source queries.

Expanded Create a Data Model and Report

Before you create data-aware reports, define data models that obtain the data from your data providers. For this tutorial, prepare the Northwind data model that provides the Orders and Customers tables as well as the Order Details view.

Open an existing report or create a new one as described in the Create and Customize Reports document to get started with this tutorial.

Expanded Bind the Report to Data

To obtain a report's dynamic data from an external data source, do the following:

  1. Click the main menu button and select Add SQL Data Source to create a new data source.

  2. On the first page of the invoked SQL Data Source Wizard, select an available data model and click Next to proceed.

  3. On the next page, choose which tables, views and/or stored procedures to add to the data source.

    Select the Order Details view. Click the Queries category's plus button to create a custom query in the Query Builder and display information from two different tables at the same hierarchical level.

    In the invoked Query Builder, add the Orders and Customers data tables to the query and join them based on a key column.

    Give the Orders name to the created query and click OK to close the Query Builder.

    Note

    If the Custom SQL Query Execution Mode option is set to Execute SELECT Statements Only or Execute All in the General Settings window, you can write a custom SQL query instead of constructing it in the Query Builder. See Write a Custom SQL Query for more information.

    Click Next on the wizard page to proceed.

  4. The next wizard page allows you to configure parameters for a custom query. Click Next to skip this step.

  5. On the following wizard page, specify key fields to define master-detail relationships between queries. Click the plus button next to the master query, choose the detail query to add a new relationship and specify the relationship condition as shown in the following image:

  6. Click Finish to complete the wizard.

Expanded View the Result

The Field List displays the data source hierarchy after you connect a report to data.

A report's Data Source and Data Member properties specify the report's data binding.

Expanded See Also

Is this topic helpful?​​​​​​​