Lesson 1: Creating A Report Server Project: Business Intelligence Development Studio
Lesson 1: Creating A Report Server Project: Business Intelligence Development Studio
Lesson 1: Creating A Report Server Project: Business Intelligence Development Studio
To create a report in SQL Server, you must first create a report server project where you will
save your report definition (.rdl) file and any other resource files that you need for your report.
Then you will create the actual report definition file, define a data source for your report, define
a dataset, and define the report layout. When you run the report, the actual data is retrieved and
combined with the layout, and then rendered on your screen, from where you can export it, print
it, or save it.
In this lesson, you will learn how to create a report server project in Business Intelligence
Development Studio. A report server project is used to create reports that run on a report server.
1. Click Start, point to Programs, point to Microsoft SQL Server 2005, and then click
Business Intelligence Development Studio.
2. On the File menu, point to New, and then click Project.
3. In the Project Types list, click Business Intelligence Projects.
4. In the Templates list, click Report Server Project.
5. In Name, type Tutorial.
6. Click OK to create the project.
1. In Solution Explorer, right-click Reports, point to Add, and click New Item.
Note:
If the Solution Explorer window is not visible, from the View menu, click Solution
Explorer.
The following diagram illustrates the Add New Item dialog box, used for adding reports
and other items to a project.
2.
3. In Name, type Sales Orders.rdl and then click Add.
The Report Designer opens and displays the new .rdl file in the Data view.
You define your data in the Data view. You define your report layout in the Layout view. You
can run the report and see what it looks like in the Preview view.
You have successfully created a Tutorial report project and added a report definition (.rdl) file to the
report project. Next, you will specify a data source to use for the report. See Lesson 2: Setting Up
Connection Information.
In this tutorial, you will use the AdventureWorks sample database as your data source. This
tutorial assumes that this database is located in the default instance of SQL Server Database
Engine installed on your local computer.
To set up a connection
1. In the Data tab, expand the contents of the Dataset drop-down list at the top of the page,
and select New Dataset. The Data Source dialog box appears.
2. In Name, type AdventureWorks.
3. In Type, select Microsoft SQL Server.
4. In Connection string, type the following:
Copy
This connection string assumes that Business Intelligence Development Studio, the report
server, and the AdventureWorks database are all installed on the local computer and that
you have permission to logon to the AdventureWorks database.
If you are using SQL Server 2005 Express Edition with Advanced Services or a named
instance, the connection string must include instance information:
Copy
For more information about connection strings, see Connecting to a Data Source and
Data Source (General Tab, Report Designer).
The following diagram illustrates the Data Source dialog box used for specifying a connection
to a data source.
Next Task
You have successfully defined a connection to the AdventureWorks sample database. Next, you
will create the report. See Lesson 3: Defining a Query for the Report.
The generic query designer is the default query design tool because it accommodates complex
Transact-SQL statements and it does not format or validate the statements until you run the
report. However, if you are more familiar with the graphical query designer, you can use it
instead of the generic query designer. A toggle button on the query designer toolbar is provided
so that you can switch tools. For more information about query designers, see Query Design
Tools in Reporting Services.
Copy
2. To view the results of the query, click the Run (!) button on the query designer toolbar.
The following diagram shows the generic query designer with the query copied into the SQL
pane. Notice that the toggle button for enabling the generic query designer is selected. You can
click this button if you want to use the graphical query designer instead.
3. In the Datasets window, expand the report dataset to display the fields.
Note:
If the Datasets window is not visible, in the View menu, click Datasets.
4. Drag the OrderDate field from the Datasets window to the middle (detail) row of the
first column in the table.
When you drop the field into the middle cell, two things happen. First, the detail cell will
contain the following text: "=Fields!OrderDate.Value". This text is a field expression that
specifies data values for the OrderDate field. Fields that you add to a Detail row are
always specified as expressions. Second, a column header value is automatically placed
in the first row, just above the field expression. By default, the column is the name of the
field.
5. Drag the SalesOrderNumber field from the Datasets window to the middle (detail) row
of the second column in the table.
6. Drag the TotalDue field from the Datasets window to the middle (detail) row of the third
column in the table.
Note:
You will not use all of the fields in the query in this tutorial. The additional fields are used
in a later tutorial.
The following diagram shows a table data region that has been populated with these fields:
OrderDate, SalesOrderNumber, and TotalDue.
Next Task
You have successfully defined the layout for your report. Next, you will preview the report to see
what it looks like. See Lesson 5: Previewing the Basic Report.
Lesson 5: Previewing the Basic Report
At this point in the tutorial, you can preview the contents of the table. Previewing a report allows
you to easily view the appearance of the report without having to go through the extra steps of
publishing it to a report server.
To preview a report
1. Save the report project. On the File menu, click Save All.
2. Click the Preview tab. Report Designer runs the report and displays it in Preview view.
Next Lesson
This step concludes the tutorial, "Creating a Basic Report". To add more features to this report,
continue working on this report in another tutorial: Tutorial: Adding Grouping, Sorting, and
Formatting to a Basic Report.
Requirements
Your system must have the following installed to use this tutorial:
Note:
To complete this tutorial, you must be running Reporting Services in native mode. If you
are running Reporting Services in SharePoint integrated mode, the steps that use report
server URLs will not work. For more information about Reporting Services modes, see
Deployment Modes for Reporting Services. For more information about deploying
projects, see Deploying Reports, Models, and Shared Data Sources to a SharePoint Site.
Note:
Business Intelligence (BI) Development Studio is not supported on Itanium-based
computers. However, support for BI Development Studio is available for x64-based
computers. If the SQL Server sample databases have been deployed on an Itanium-based
computer, use BI Development Studio on either an x86-based or x64-based computer to
modify and run the samples.
You must also have permissions to retrieve data from the AdventureWorks database and to
publish reports to the report server.
Requirements
Your system must have the following installed to use this tutorial:
Note:
To complete this tutorial, you must be running Reporting Services in native mode. If you
are running Reporting Services in SharePoint integrated mode, the steps that use report
server URLs will not work. For more information about Reporting Services modes, see
Deployment Modes for Reporting Services. For more information about deploying
projects, see Deploying Reports, Models, and Shared Data Sources to a SharePoint Site.
Note:
Business Intelligence (BI) Development Studio is not supported on Itanium-based
computers. However, support for BI Development Studio is available for x64-based
computers. If the SQL Server sample databases have been deployed on an Itanium-based
computer, use BI Development Studio on either an x86-based or x64-based computer to
modify and run the samples.
You must also have permissions to retrieve data from the AdventureWorks database and to
publish reports to the report serv
Adding a Group
You can add a group to the table that groups and sorts data by sales person. Adding a group organizes
sales information into logical units of data by showing sales data for each sales person. You can add
groups to tables, matrices, and lists.
1. In the Layout pane, click the table so that column and row handles appear above and next
to the table. For more information about parts of a table, see Working with Table Data
Regions.
Note:
Handles are gray boxes that appear above and next to the table. You use handles to
perform various actions on columns, rows, and the table itself. The handles that run across
the top of the table are column handles. The handles that run down the side of the table are
row handles. The handle where the column and row handles meet is the corner handle.
2. Right-click on the handle of any row and then click Insert Group.
3. On the General tab, for Group on, select =Fields!LastName.Value in the first row and
=Fields!FirstName.Value in the second row. This will group the data by sales person
name.
4. On the Sorting tab, for Sort on, select =Fields!LastName.Value in the first row and
=Fields!FirstName.Value in the second row, each with a direction of Ascending. This
will sort the groupings by sales person name.
1. Click the table so that column and row handles appear above and next to the table.
2. On the first column (Order Date), right-click on the handle and then click Insert Column
to the Left.
3. Click on the second cell in the new column and type the following expression. The
second cell should be in the new group row that was added in previous steps.
Copy
5. Click OK. Two new rows, a group header and a group footer, are added to the table.
1. In the Layout pane, click the table so that column and row handles appear above and next
to the table.
2. Right-click the corner handle and then click Properties.
Note:
The corner handle is the handle where the column and row handles meet.
3. On the Sorting tab, for Sort on, select =Fields!OrderDate.Value. This will sort the
detail data by order date.
4. Click OK.
Next Steps
You have successfully added an expression that sorts sales data for each sales person. Next, you
will add a subtotal to calculate and display the dollar sales for each sales person. See Lesson 5:
Adding a Subtotal.
Click on the fourth cell in the last (Total Due) column and type the following expression.
Copy
=Sum(Fields!TotalDue.Value)
Date Format
The OrderDate field displays date and time information by default. You can add formatting to
display only the date.
1. Right-click the cell with the OrderDate field expression and then click Properties. The
Textbox Properties dialog box appears.
2. Open the Format tab and click the browse button (indicated by the ellipses button label)
to open the Choose Format dialog box.
3. For Format, select Standard, select Date, and then select the third example on the list
(short date).
4. Click OK to close the Choose Format dialog box, and then click OK again to close the
Textbox Properties dialog box.
Currency Format
The TotalDue field displays a general number. Add formatting to display the number in currency
format.
1. Right-click the cell with the TotalDue field expression and then click Properties.
2. Open the Format tab and click the browse button (indicated by the ellipses button label)
to open the Choose Format dialog box.
3. For Format, select Standard, select Currency, click OK, and then click OK again to
close the Textbox Properties dialog box.
Text Style and Column Widths
You can also add style to the table headers to differentiate them from the rows of data in the
report, and adjust the widths of the columns.
1. Click the table so that column and row handles appear above and next to the table.
2. Select the row handles of the first, second, and fourth rows (the row containing column
header labels, the group header row, and the group footer row) and then click the Bold
(B) button on the formatting toolbar.
Note:
To select multiple items, hold down the CTRL key and click on each item.
3. Point to the line between column handles so that the cursor changes into a double arrow.
Drag the columns to size.
Lesson 7: Publishing the Updated Report
Use Preview to examine the report before publishing it to the report server. After you preview
the report, you can make further modifications in the Layout view or publish it to a report server.
Before you publish the report, you must switch to the Production configuration and set the
location of the report server.
To publish a report
1. In the Solution Explorer window, right-click the Tutorial project, and then click
Properties.
Note:
If the Solution Explorer window is not visible, in the View menu, click Solution
Explorer.
5. In the Tutorial Property Pages dialog, in TargetServerURL, type the report server
virtual directory; for example, http://servername/reportserver. (This is the virtual
directory of the report server, not Report Manager.)
Note:
If the report server is on the same computer as Report Designer, you can use localhost as
the server name, for example, http://localhost/reportserver or
http://localhost/reportserver$SQLEXPRESS. For more information about report server
names, see Configuring Report Server Virtual Directories.
6. Expand the Debug properties node if it is not already open to show the StartItem
property. Click in the textbox next to StartItem and from the drop-down list, select the
report SalesOrder.rdl.
7. Click OK.
8. Save the report project. On the File menu, click Save All.
9. Publish the report. On the Debug menu, click Start Without Debugging.
10. When publishing is complete, Report Designer opens Internet Explorer. Click Sales
Orders to view the report.