1. Trang chủ
  2. » Công Nghệ Thông Tin

Microsoft SQL Server 2005 Developer’s Guide- P38 pptx

10 164 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 887,76 KB

Nội dung

Chapter 9: Reporting Services 349 wizard dialog will ask you to design a query to execute to retrieve the data for your report. A Query Builder button allows you to interactively create your query statement. Next, you will be prompted to select a report type, tabular or matrix. The next dialog asks how you would like your report grouped. A list of available fields is displayed for you to select and assemble according to Page, Group, or Detail sections on your report pages. You then choose the layout of your report and the style of your report. After you select your report data, groupings, and layout, a summary dialog will be displayed where you can name your report and optionally choose to preview the report. The Report Wizard Summary is shown in Figure 9-6. If you have chosen to preview your report, clicking the Finish button on the Report Wizard Summary page executes the query and generates the report to a preview pane in the BI Development Studio environment as shown in Figure 9-7. Figure 9-6 Report Wizard summary 350 Microsoft SQL Server 2005 Developer’s Guide Using the Report Designer to Create a Report To start the Report Designer and create a report project, you open up SQL Server 2005’s Business Intelligence Development Studio and then select File | New | Project. On the New Projects dialog, click the Business Intelligence Projects options from the Project Types list box to view the installed BI project templates and select the Report Project template. Type a name and location for the project and click OK to create the report project. You can see an example of the Reporting Services Report Designer in Figure 9-8. The next section discusses each of the Report Designer elements. Design Surface In the center of the screen in Figure 9-8 you can see the Report Designer’s design surface. The design surface presents three tabs: Data, Layout, and Preview. To create a report, you must first define a dataset by clicking the Data tab to reveal the Data pane. You create datasets in the Data pane to access data sources to include in your report. When you create a dataset in your project, the dataset is added Figure 9-7 Report preview Chapter 9: Reporting Services 351 to the Dataset window located on the left side of the design environment. The dataset is built by selecting New Dataset from the drop-down box at the top of the Data pane. A Dataset dialog will then be displayed prompting you to specify the dataset name, data source, command type, and query statement. If you leave the query section of the Dataset dialog blank and click the OK button, a blank dataset will be created. You can then click the Generic Query Designer button, which causes the query builder tool to be displayed in the Data pane and allows you to interactively build a query for your dataset. You can see an example of the interactive query builder in Figure 9-9. The Layout tab is where you design your report. You design the report by dragging and dropping items from the Toolbox window (which is located on the left side of the design environment) onto the Layout pane and then moving and resizing them. As you can see in Figure 9-8, the Layout pane shows all of the Reporting Services controls that have been added to the report. Figure 9-8 Report Designer 352 Microsoft SQL Server 2005 Developer’s Guide The Preview tab allows you to preview what the rendered report will look like. When you click the Preview tab, the Report Designer will execute the report and display it in the Preview tab. The Preview doesn’t allow you to make changes to the way the report looks. In order to change the report, you need to use the Layout tab. Toolbox The Toolbox window in the Reporting Services Report Designer is shown on the left side of the screen in Figure 9-8. The Toolbox is used to drag and drop components onto their respective design surfaces. The general report controls are listed here: ᭤ Textbox The Textbox control enables you to display textual data on your report. The text box can be placed anywhere on the report and can contain column data, labels, and calculated fi elds. ᭤ Line The Line control enables you to draw a line on the report layout. ᭤ Table The Table control enables you to bind a table to the report layout. ᭤ Matrix You can use the Matrix control to display a grid on the report layout. You can bind the Matrix control to the report’s dataset. Figure 9-9 Data pane – Interactive Query Builder Chapter 9: Reporting Services 353 ᭤ Rectangle The Rectangle control is primarily used as a container for other report elements. It can also be used as a graphical element by the Line control. ᭤ List The List control enables you to place a list on your report layout. The list can be bound to fi elds in your dataset. ᭤ Image The Image control enable you to bind binary images to the report layout. The supported formats are BMP, JPG, GIF, and PNG. ᭤ Subreport The Subreport control is used to link a section of the report to another, previously defi ned report. The Subreport can either be a stand-alone report or be expressly designed to run within another report. ᭤ Chart The Chart control draws a chart on the report layout. The Chart control can be bound to the report’s dataset and supports a large number of different chart types, including: columns, bar, line, pie, scatter, bubble, area, doughnut, radar, stock, and polar. Solution Explorer You can see the Report Designer’s Solution Explorer in the upper right-hand corner of Figure 9-8. The Solution Explorer provides a hierarchical tree view of the different projects and files that are included in a Business Intelligence Development Studio solution. The top item in the Solution Explorer hierarchy is the solution name. Under the solution, you can have one or more projects. Properties The Report Designer’s Properties window is located in the bottom-right corner of Figure 9-8. The Properties window can be used to set the attributes of each of the elements of the project, including the report layout items at design time and the location and filenames of the solution, data sources, and reports. Output The Report Designer also provides an Output window that shows the results of building and deploying reports. After a report is designed, it must be built and then deployed before it can be used. The Build process creates a .NET assembly, while the Deploy process takes that assembly and installs it in the ReportServer database. The result of these actions is shown in the Output window that you can see in the bottom of Figure 9-8. Report Model Designer The Report Model Designer is used to create a report model. A report model is a description of the metadata from a data source and its relationships. The report model is used by the Report Builder tool to search and select the data that users can employ to create reports from the data source. The Report Builder tool will use the 354 Microsoft SQL Server 2005 Developer’s Guide report model definitions to generate a query to retrieve the requested data. The report model is contained in a report model project, which consists of data source files, data source view files, and report model files. Each report model file can reference only one data source file and one data source view file. Report model project can be generated only from SQL Server and Analysis Services databases. The Report Model Designer is shown in Figure 9-10. To build a report model, you open up SQL Server 2005’s Business Intelligence Development Studio and then select File | New | Project. On the New Projects dialog, click the Business Intelligence Projects options from the Project Types list box to view the installed BI project templates and select the Report Model Project template. Type a name and a location for the project and click OK. A blank project will be started that contains elements like the Report Designer elements discussed previously, including the Solution Explorer window, the Properties window, and the design surface. However, the items inside each of these windows reflect the file types that are needed for this type of project. For example, Figure 9-10 Report Model Designer Chapter 9: Reporting Services 355 the Solution Explorer window shows a tree hierarchy that includes the folders Data Sources, Data Source Views, and Report Models; whereas the Report Designer’s Solution Explorer window included folders for Shared Data Sources and Reports. The first thing to do in the report model project is to add a data source to the project. Right-click the Data Sources folder in the Solution Explorer window and select the Add New Data Source option. A wizard will prompt you to select a server and a database name. Next, you need to add a data source view. Right-click the Data Source View folder in the Solution Explorer window and select the Add New Data Source View option. Another wizard will prompt you to select a data source and then tables and views to include in your data source view. You can open a data source view file and edit it interactively in the design surface. The data source view is displayed as a list of tables and a diagram showing the relationships of the tables. In the design surface you can add or remove tables, add new relationships, create named queries, replace tables, explore table data, and delete the table from the data source view. You can see an example of a data source view in Figure 9-11. After a data source and a data source view have been created, you create a report model. A report model specifies the business entities, data fields, and roles that will Figure 9-11 Data source view 356 Microsoft SQL Server 2005 Developer’s Guide be used in the report. Right-click the Report Model folder in the Solution Explorer window and select the Add New Report Model option. A wizard will start, prompting you to select a data source view. The next screen displays a list of options that allows you to choose the rules that will be used to generate the metadata information from the data source to produce the report model. Figure 9-12 shows the prompt to select report model generation rules. After the report model is created, it needs to be published to the server before the Report Builder tool can use it to actually create a report. When a report model is published to the server, the data source and data source view are included in the publication. To publish the report model to the server, right-click the Report Model Project in the Solution Explorer and select the Deploy option. This will build the project and deploy it to your server. Figure 9-12 Report model generation rules Chapter 9: Reporting Services 357 Report Builder Once a report model has been created and published to the server, the Report Builder tool can be used to design and run a report based on the report model. Using the Report Builder, users can create table, matrix, or chart reports; use a report layout template; and select a predefined report model. Users can also add text and formatting to the report; create new fields and perform calculations to add to the report; and preview, print, and publish the completed report to the server. Using the report model information, the Report Builder will automatically generate a query that will retrieve all the requested data to include in the report. The Report Builder is accessed through the Report Manager. To launch the Report Builder, point your Web browser to http://<servername>/reports, and then click the Report Builder button. A dialog will be displayed allowing you to choose a source of data for your new report. Select a data source and click OK to start the Report Builder interface. Figure 9-13 shows the Report Builder interface. Figure 9-13 Report Builder 358 Microsoft SQL Server 2005 Developer’s Guide Report Builder Elements The next section discusses the Report Builder elements. Explorer The Report Builder Explorer window, which is shown on the left side of Figure 9-13, displays the tables and items in your data source that are available to your report. Selecting one of the items in the Explorer window will display the fields associated with that item listed in the Fields window. Fields The Fields window is shown in Figure 9-13, below the Explorer window on the left side of the Report Builder environment. You can drag and drop fields from the Fields window onto the design surface of the Report Builder. Design Surface The design surface is displayed in the middle of the Report Builder and shows a grid layout for placing fields and items on your report. Areas on the design surface are predefined to accept the dragged and dropped fields, according to the Report Layout template chosen. Report Layout The Report Layout window, shown on the right side of the Report Builder, allows you to select from six different predefined report layout templates. You can choose a table report, a table report with subtitles, a matrix report, a matrix report with subtitles, a chart report, or a chart report with subtitles. Filter The Filter icon on the Report Builder toolbar displays a Filter dialog box allowing you to drag and drop fields onto a Filter pane on the right side of the dialog. The Filter dialog box is used to narrow the data results that are returned and used in your report. When fields are dropped onto the Filter pane in the dialog, the filter results are automatically created for you and incorporated into your report. Sort and Group The Sort and Group icon on the Report Builder toolbar allows you to organize your report data into groups and to sort the data in an ascending or descending manner. Run Report You can select the Run Report icon on the Report Builder toolbar to see the results of the report design populated with your actual data. Your report is rendered and displayed in the preview area of the Report Builder. From the preview mode you can view individual pages, filter your report, export your report, or print your report. To return to design mode, select the Design Report option from the main menu. . summary 350 Microsoft SQL Server 2005 Developer’s Guide Using the Report Designer to Create a Report To start the Report Designer and create a report project, you open up SQL Server 2005 s Business. Services controls that have been added to the report. Figure 9-8 Report Designer 352 Microsoft SQL Server 2005 Developer’s Guide The Preview tab allows you to preview what the rendered report will. to create reports from the data source. The Report Builder tool will use the 354 Microsoft SQL Server 2005 Developer’s Guide report model definitions to generate a query to retrieve the requested

Ngày đăng: 05/07/2014, 05:20

TỪ KHÓA LIÊN QUAN