This walkthrough expands upon the report created in the Walkthrough: Basic Report. If you have not created the basic report already, please do so before continuing.
This walkthrough illustrates how to create a drill-through link to another report containing details about the linked item.
The walkthrough is split up into the following activities:
- Creating a detail report and saving it into the basic report folder
- Connecting the detail report to a data source
- Adding a Dataset with a parameter
- Creating a Dataset to populate the parameter values
- Adding a Report Parameter
- Adding controls to the report to contain data
- Adding a drill-through link from the basic report to the detail report and passing a parameter
- Viewing the report
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 detail report and saving it into the basic report folder
To create a report in Visual Studio
- Open the Basic Report project you created previously in Visual Studio.
- From the Visual Studio Project menu, select Add New Item.
- In the Categories pane, select Data Dynamics Reports.
- In the Templates pane, select Report and name the report MovieDetails.rdlx.
- Click Add in Visual Studio 2005.
Connecting the detail report to a data source
To connect the detail report to a data source
- If the Data Explorer is not in view, from the View menu, select Other Windows, then Data Dynamics Reports Data Explorer (at the bottom).
- Click the Add icon and select the Data Source... option.
- In the Report DataSource smart panel that appears, select the General page.
- Change the Name to Reels.
- Select the Shared Reference checkbox.

- 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\. - 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 with a parameter
To add a Dataset with a parameter
- Click the Add icon and select the Data Set... option.
- In the DataSet smart panel that appears, select the General page.
- Change the Name to MovieInfo.
- On the Parameters page under Parameter Name enter MovieID.
- Under Value enter
=Parameters!MovieID.Value
- On the Query page, paste the following SQL command into the Query text box:
SELECT * FROM MovieCastInformation;
- Click the Validate icon to validate the query and to populate the Fields list.
- Click the Accept button in the lower right corner to close the smart panel and see MovieInfo and the selected fields appear in the Data Explorer.

Creating a Dataset to populate the parameter values
To create a Dataset to populate the parameter values
- Click the Add icon and select the Data Set... option.
- In the DataSet smart panel that appears, select the General page.
- Change the Name to MovieTitles.
- On the Query page, paste the following SQL command into the Query text box:
SELECT MovieID, Title FROM Movie
ORDER BY Title ASC; - Click the Validate icon to validate the query and to populate the Fields list.
- Click the Accept button in the lower right corner to close the smart panel and see MovieTitles and the selected fields appear in the Data Explorer.

Adding a Report Parameter
To add a Report Parameter
- In Layout view, click in or below the report body to ensure that the report has focus.
- From the Report menu, select Report Parameters.
- In the Report Parameters smart panel that appears, click the Add button to add a parameter.
- Change the Name to MovieID.
- Change the Data type to Integer. (This data type must match that of the field.)
- Enter the following text to prompt users for a value: Movie.
-
To provide a list of values for the Report Parameter
- Just below the list of parameters, click the Values icon.
- Under Available Values, select From query.
- Under Dataset, select MovieTitles.
- Under Value field, select MovieID.
- Under Label field, select Title.
- Click the Accept button in the lower right corner to close the smart panel and add the parameter to the collection.

- Just below the list of parameters, click the Values icon.
Adding controls to the report to contain data
To add data regions to the report
- From the toolbox, drag a List data region onto the body of the report.
- With the new list selected in the property grid, set the DataSetName property to MovieInfo.
- Set the Location property to 0in, 0in.
- Set the Name property to MovieList.
- Set the Size property to 6.5in, 1.25in.
- Right-click the list and select Properties.
- On the Detail Grouping page, set the Group on: Expression to =Fields!MovieID.Value.
- Click the Accept button in the lower right corner to close the smart panel and accept the changes.

- From the toolbox, drag another List data region onto the first list.
- With the new list selected in the property grid, set the DataSetName property to MovieInfo.
- Set the Size property to 1.5in, 0.25in.
- Set the Location property to 4.75in, 1in.
- Set the Name property to GenreList.
- Right-click the list and select Properties.
- On the Detail Grouping page, set the Group on: Expression to =Fields!GenreID.Value.
- Click the Accept button in the lower right corner to close the smart panel and accept the changes.

- From the toolbox, drag another List data region onto the first list to the left of GenreList.
- With the new list selected in the property grid, set the DataSetName property to MovieInfo.
- Set the Size property to 3.125in, 0.25in.
- Set the Location property to 0in, 1in.
- Set the Name property to CrewList.
- Right-click the list and select Properties.
- On the Detail Grouping page, set the Group on: Expression to =Fields!CrewTitleID.Value.
- Click the Accept button in the lower right corner to close the smart panel and accept the changes.

- From the toolbox, draw another List data region onto CrewList. (Draw it small so that it doesn't change the size of CrewList.)
- With the new list selected in the property grid, set the DataSetName property to MovieInfo.
- Set the Size property to 1.875in, 0.25in.
- Set the Location property to 1in, 0in.
- Set the Name property to CastNameList.
- Right-click the list and select Properties.
- On the Detail Grouping page, set the Group on: Expression to =Fields!MoviePersonID.Value.
- Click the Accept button in the lower right corner to close the smart panel and accept the changes.

To add data fields to the report
- From the Data Explorer, drag the Title field onto the main MovieList data region.
- With the new textbox selected in the property grid, set the Location property to 0in, 0in.
- Set the Name property to MovieTitle.
- Set the Size property to 6.5in, 0.375in.
- Set the TextAlign property to Center and the FontSize property to 14pt.


- From the Data Explorer, drag the YearReleased field onto the main MovieList data region just below the Title textbox.
- With the new textbox selected in the property grid, set the Location property to 1in, 0.375in.
- Set the Name property to YearReleased.
- Set the Size property to 0.75in, 0.25in.
- Set the TextAlign property to Left.
- From the Data Explorer, drag the MPAA field onto the main MovieList data region to the right of the YearReleased textbox.
- With the new textbox selected in the property grid, set the Size property to 0.5in, 0.25in.
- Set the Location property to 6in, 0.375in.
- Set the Name property to MPAA.
- From the Data Explorer, drag the UserRating field onto the main MovieList data region below the YearReleased textbox.
- With the new textbox selected in the property grid, set the Location property to 1in, 0.625in.
- Set the Name property to UserRating.
- Set the Size property to 0.25in, 0.25in.
- Set the TextAlign property to Left.
- From the Data Explorer, drag the Length field onto the main MovieList data region below the MPAA textbox.
- With the new textbox selected in the property grid, set the Location property to 4.75in, 0.625in.
- Set the Name property to Length.
- Set the Size property to 1.75in, 0.25in.
- Set the TextAlign property to Left.
- Add a string to the length data value so that it reads: =Fields!Length.Value & " minutes"
- From the Data Explorer, drag the CrewTitle field onto the CrewList data region and drop it in the top left corner of the list.
- With the new textbox selected in the property grid, set the Location property to 0in, 0in.
- Set the Name property to CrewTitle.
- Set the Size property to 0.875in, 0.25in.
- In the Report Formatting tool bar, click the Bold button.
- Add a string to the CrewTitle data value so that it reads: =Fields!CrewTitle.Value & "s:"
- From the Data Explorer, drag the CastName field onto the nested CastNameList data region and drop it in the top left corner of the list.
- With the new textbox selected in the property grid, set the Location property to 0.125in, 0in.
- Set the Name property to CastName.
- Set the Size property to 1.75in, 0.25in.
- From the Data Explorer, drag the GenreName field onto the GenreList data region to the right of the CrewTitle textbox.
- With the new textbox selected in the property grid, set the Location property to 0.125in, 0in.
- Set the Name property to GenreName.
- Set the Size property to 1.25in, 0.25in.
To add labels to the report
- From the toolbox, drag a TextBox onto the main MovieList data region to the left just below the Title textbox.
- With the new textbox selected in the property grid, set the Location property to 0in, 0.375in.
- Set the Name property to ReleaseLabel.
- Set the Size property to 1in, 0.25in.
- Set the Value property to Released in:.
- In the Report Formatting tool bar, click the Bold button.

- From the toolbox, drag a TextBox onto the main MovieList data region to the right of the ReleaseLabel textbox.
- With the new textbox selected in the property grid, set the Location property to 4.125in, 0.375in.
- Set the Name property to MPAALabel.
- Set the Size property to 1.875in, 0.25in.
- Set the Value property to The MPAA rated this film:.
- In the Report Formatting tool bar, click the Bold button.

- From the toolbox, drag a TextBox onto the main MovieList data region below the ReleaseLabel textbox.
- With the new textbox selected in the property grid, set the Location property to 0in, 0.625in.
- Set the Name property to UserRatingLabel.
- Set the Size property to 1in, 0.25in.
- Set the Value property to User rating:.
- In the Report Formatting tool bar, click the Bold button.

- From the toolbox, drag a TextBox onto the main MovieList data region to the right of the UserRatingLabel textbox.
- With the new textbox selected in the property grid, set the Location property to 1.125in, 0.625in.
- Set the Name property to OutOfTenLabel.
- Set the Size property to 0.625in, 0.25in.
- Set the Value property to out of 10.
- From the toolbox, drag a TextBox onto the main MovieList data region below the MPAALabel textbox.
- With the new textbox selected in the property grid, set the Location property to 4.125in, 0.625in.
- Set the Name property to LengthLabel.
- Set the Size property to 0.625in, 0.25in.
- Set the Value property to Length:.
- In the Report Formatting tool bar, click the Bold button.

- From the toolbox, drag a TextBox onto the main MovieList data region below the LengthLabel textbox.
- With the new textbox selected in the property grid, set the Location property to 4.125in, 1in.
- Set the Name property to GenreLabel.
- Set the Size property to 0.625in, 0.25in.
- Set the Value property to Genre:.
- In the Report Formatting tool bar, click the Bold button.

- From the toolbox, drag a TextBox onto the main CastNameList data region to the right of the CrewTitle textbox.
- With the new textbox selected in the property grid, set the Location property to 0in, 0in.
- Set the Name property to CrewBullet.
- Set the Size property to 0.125in, 0.25in.
- Set the Value property to • (a bullet).
- From the toolbox, drag a TextBox onto the main GenreList data region to the right of the GenreLabel textbox.
- With the new textbox selected in the property grid, set the Location property to 0in, 0in.
- Set the Name property to GenreBullet.
- Set the Size property to 0.125in, 0.25in.
- Set the Value property to • (a bullet).
- From the File menu, select Save.
Adding a drill-through link to the basic report and passing a parameter
Pass a parameter to the target report to show only relevant data.
To add a drill-through link
- Open MovieRatings.rdlx in the designer.
- Right-click the title field in the detail section of the table (=Fields!Title.Value) and select Properties.
- On the Textbox Report Item smart panel that appears, select the Navigation page.
- Under Action, select Jump to report and select MovieDetails from the drop-down box.
To pass a parameter to the report
- Under Jump to report set the Name of the parameter to MovieID.
- Set the Value to =Fields!MovieID.Value.

Caution: The parameter name must exactly match the parameter in the target report. - Click the Accept button in the lower right corner to close the smart panel and accept the changes.
- 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
- Click the Preview tab of the report designer.
- Click any movie title to drill through to details about the movie.
- Click the Back to parent report icon to return to the Movie Ratings report.

To view the report at run time
- Add the ReportPreview control to your Visual Studio toolbox and drop it onto your Windows form.
- Set the Dock property of ReportPreview1 to Fill so that it will automatically resize if the form is resized at run time.
- 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);
- Run the project.