Data Dynamics Reports Online Help
Walkthrough: Basic Report
Support Forum
User Guide > Samples and Walkthroughs > Walkthroughs > Walkthrough: Basic Report

Glossary Item Box

You can create a basic report in minutes using the Data Dynamics Reports Table control.

This walkthrough illustrates how to create a simple tabular report. 

The walkthrough is split up into the following activities:

To complete the walkthrough, you must have access to the Reels sample database included with this installation.

When you are finished you will have a report that looks similar to the following.

Creating a Data Dynamics Report

To create a report in Visual Studio

  1. Create a new project in Visual Studio.
  2. From the Visual Studio Project menu, select Add New Item.
  3. In the Categories pane, select Data Dynamics Reports.
  4. In the Templates pane, select Report and name the report MovieRatings.rdlx.
  5. Click Add in Visual Studio 2005. 

Connecting the report to a data source

To connect the report to a data source

  1. If the Data Explorer is not in view, from the View menu, select Other Windows, then Data Dynamics Reports Data Explorer (at the bottom).
  2. Click the Add icon and select the Data Source... option.
  3. In the Report DataSource smart panel that appears, select the General page.
  4. Change the Name to Reels.
  5. Check the Shared Reference checkbox.

  6. Click the Browse button and select ReelsDataSource.rdsx, which is located in C:\My Documents\Data Dynamics\Reports\build number\Samples\Reels.

    Note: In Windows Vista, the path is C:\User\your name\Documents\Data Dynamics\Reports\build number\Samples\Reels\.
  7. Click the Accept button in the lower right corner to close the smart panel and see Reels appear in the Data Explorer.

Adding a dataset

To add a dataset

  1. Click the Add icon and select the Data Set... option.
  2. In the DataSet smart panel that appears, select the General page.
  3. Change the Name to MovieRatings.
  4. On the Query page, paste the following SQL command into the Query text box:
     

    SELECT Movie.MovieID, Movie.Title, Movie.YearReleased, Movie.MPAA FROM Movie ORDER BY Movie.YearReleased;

  5. Click the Validate icon to validate the query and to populate the Fields list.
  6. Click the Accept button in the lower right corner to close the smart panel and see MovieRatings and the selected fields appear in the Data Explorer.

Adding controls to contain data

To add controls to the report

  1. From the toolbox, drag a Table data region onto the body of the report.
  2. Hover your mouse over the Textbox located in the first column of the Detail row to make the Field Selection Adorner appear.
  3. Click on this adorner to display a list of available fields from the MovieRatings DataSet, select Title from this context menu.
    Note: This automatically places an expression in the detail row and simultaneously places a static label in the header row of the same column.
  4. Using the Field Selection Adorner, select the MPAA field for the second column of the Detail row of the table.
  5. Use this same method to select the YearReleased field for the third column of the Detail row.
  6. To optionally display the static labels in bold at the top of every page of the report:
    • Select the Header row by clicking the table handle to the left of the row.
    • In the Report Formatting tool bar, click the Bold button.
    • In the Properties grid, set the RepeatOnNewPage property to True.
  7. To improve the appearance of the report:
    • Select the second column and change its Width property to 1in.
    • Select the third column and change its Width property to 1.1in.
    • Select the first column and change its Width property to 4.4in.
    Tip: Making some columns narrower before making other columns wider prevents your report width from changing.
  8. To add a page header to the report:
    • Click below the report to give it focus and from the Report menu, select Page Header.
    • From the toolbox, select Textbox and draw it onto the page header section to span the entire width of the report.
    • Set the TextAlign property to Center and the FontSize property to 14pt.
    • Click inside the textbox and enter the text Movie Ratings.
  9. From the File menu, select Save.

Viewing the report

Any report designed with Data Dynamics Reports can be opened in the included Data Dynamics Reports Viewer application or you can view it at design time.

To view the report at design time

  1. Click the Preview tab of the report designer.

To view the report at run time

  1. Add the ReportPreview control to your Visual Studio toolbox and drop it onto your Windows form.
  2. Set the Dock property of ReportPreview1 to Fill so that it will automatically resize if the form is resized at run time.
  3. Double-click the viewer to go to the Load event and use code like the following.
    'Visual Basic.NET 
    Dim rpt As New System.IO.FileInfo(Application.StartupPath & "..\\..\\MovieRatings.rdlx") 
    Me.ReportPreview1.OpenReport(rpt)
    //C# 
    System.IO.FileInfo rpt = new System.IO.FileInfo(Application.StartupPath + @"..\..\..\MovieRatings.rdlx"); 
    this.reportPreview1.OpenReport(rpt);
  4. Run the project.
©2010. GrapeCity, inc. All Rights Reserved.