1. Trang chủ
  2. » Giáo Dục - Đào Tạo

microsoft reporting services in actionmanning publications

654 253 0
Tài liệu đã được kiểm tra trùng lặp

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

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Microsoft Reporting Services in Action
Tác giả Teo Lachev
Trường học Manning Publications Co.
Thể loại Sách chuyên khảo
Năm xuất bản 2005
Thành phố Greenwich
Định dạng
Số trang 654
Dung lượng 16,54 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

brief contents1 Introducing Microsoft Reporting Services 1 2 Report authoring basics 39 3 Working with data 63 4 Designing reports 102 5 Using expressions and functions 142 6 Using custo

Trang 2

Microsoft Reporting Services in Action

Trang 4

Microsoft Reporting Services in Action

M A N N I N G

Greenwich

(74° w long.)

Trang 5

For online information and ordering of this and other Manning books, please go to

www.manning.com The publisher offers discounts on this book when ordered in

quantity For more information, please contact:

Special Sales Department

Manning Publications Co.

209 Bruce Park Avenue Fax: (203) 661-9018

Greenwich, CT 06830 email: orders@manning.com

©2005 by Manning Publications Co All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted,

in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher.

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in the book, and Manning

Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps.

Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end.

Manning Publications Co Copyeditor: Linda Recktenwald

209 Bruce Park Avenue Typesetter: Denis Dalinnik

Greenwich, CT 06830 Cover designer: Leslie Haimes

ISBN 1-932394-22-2

Printed in the United States of America

1 2 3 4 5 6 7 8 9 10 – VHG – 08 07 06 05 04

Trang 6

To my beautiful wife, Elena, and our lovely children, Maya and Martin, for your sacrifices in making this book a reality

To my parents for supporting my decisions to take the road less traveled

and for always being very proud of me

Trang 8

brief contents

1 Introducing Microsoft Reporting Services 1

2 Report authoring basics 39

3 Working with data 63

4 Designing reports 102

5 Using expressions and functions 142

6 Using custom code 183

7 Managing the Reporting Services environment 215

8 Securing Reporting Services 260

9 On-demand report delivery 299

10 Reporting for Windows Forms applications 337

11 Reporting for web-based applications 377

12 Reporting for OLAP applications 416

13 Enterprise reporting 456

14 Subscribed report delivery 483

15 Extending Reporting Services 517

16 Performance and scalability 566

Trang 10

foreword xix preface xxi acknowledgments xxiii roadmap xxv

source code xxviii author online xxxiii about the title and cover xxxiv

1 Introducing Microsoft Reporting Services 1

1.1 What is RS? 2

Why do we need RS? 2 ✦ How is RS implemented? 4

RS and the Microsoft BI platform 5

1.2 RS at a glance 6

Authoring features 7 ✦ Management features 8 Delivery features 9 ✦ Extensibility features 9 Scalability features 10 ✦ Security features 10 Deployment features 11

1.3 RS architecture 11

The Report Server 13 ✦ The Report Server database 14 The Report Manager 15

1.4 Understanding Report Processing 17

Execution stage 18 ✦ Rendering stage 18

1.5 Delivering reports 20

On-demand delivery 20 ✦ Subscribed delivery 21

1.6 What is the report lifecycle? 221.7 RS in action 23

About the Adventure Works Reporter 23 ✦ Your first report 24

1.8 Evaluating RS 33

Trang 11

1.9 Summary 351.10 Resources 35

2 Report authoring basics 39

2.1 The report-authoring process: step by step 40

Analysis 41 ✦ Construction 42 ✦ Testing 42 Deployment 42

2.2 Authoring reports in VS.NET 43

Authoring reports with the Report Wizard 43 ✦ Authoring reports with the Report Designer 44 ✦ Importing reports from Microsoft Access 53

2.3 Creating reports programmatically 55

The AW Ad Hoc Reporter sample 56 ✦ Implementation details 58

2.4 Creating reports with third-party tools 60

Cizer’s Quick Query 60 ✦ Hitachi’s RDL Generator 62

2.5 Summary 622.6 Resources 62

3 Working with data 63

3.1 Working with data sources 63

Connecting to the database 64 ✦ Choosing an authentication mechanism 69 ✦ Deploying data sources 77

3.2 Working with report datasets 77

Understanding the dataset definition 78 ✦ Creating a report dataset 79 ✦ Using multiple datasets 83

3.3 Authoring dataset queries 84

Using the Graphical Query Designer 84 ✦ Using the Generic Query Designer 86

3.4 Parameter-driven reports 89

The role of parameters 89 ✦ Building parameter-driven queries 90 ✦ Setting up the report-level parameters 92 Working with stored procedures 95

3.5 Data limitations 100

Data source limitations 100 ✦ Parameter limitations 101

3.6 Summary 1013.7 Resources 101

Trang 12

4 Designing reports 102

4.1 Anatomy of a report 103

Getting started with a new report 104 ✦ Understanding report sections 104 ✦ Understanding report items 105

Understanding data regions 107

4.2 Designing tabular reports 109

Parameterized tabular reports 113 ✦ Tabular reports with interactive features 117 ✦ Table region limitations 119

4.3 Designing freeform reports 119

Freeform reports with nested regions 119 ✦ Grouping freeform data 121 ✦ Freeform reports with side-by-side data

regions 123

4.4 Designing Chart Reports 124

The chart data region 124 ✦ Working with charts 126 Nesting chart regions 127

4.5 Designing crosstab reports 129

Matrix region advantages 129 ✦ Working with the matrix region 130 ✦ Adjusting the report layout 134

4.6 Designing Subreports 135

Laying out the report 136 ✦ Synchronizing the subreport with the master report 137

4.7 Designing multicolumn reports 138

Setting up multiple columns 139 ✦ Testing multicolumn reports 139

4.8 Summary 1404.9 Resources 141

5 Using expressions and functions 142

5.1 Understanding expressions 143

Using the Expression Editor 143 ✦ Expression syntax 145 Determining expression execution order 145 ✦ Understanding expression scope 146 ✦ Dealing with expression errors 147

5.2 Exploring the Report Object Model 148

Using the ReportItems collection 151 ✦ Using the Fields collection 155 ✦ Using the Parameters collection 157 Using the Globals collection 159 ✦ Using the User collection 159

5.3 Working with functions 160

Referencing external functions 160 ✦ Using aggregate functions 161 ✦ Using other internal functions 165

Trang 13

5.4 Designing reports with navigational features 167

Reports with hyperlinks 168 ✦ Reports with document maps 170

5.5 Report rendering considerations 173

Exporting reports to HTML 173 ✦ Exporting reports to MHTML 174 ✦ Exporting reports to HTML with Office Web Components 174 ✦ Exporting reports to other formats 176

5.6 Designing localized reports 177

Report localization basics 177 ✦ Localization techniques 179

5.7 Summary 1815.8 Resources 182

6 Using custom code 183

6.1 Understanding custom code 184

Using embedded code 184 ✦ Using external assemblies 187

6.2 Custom code in action: implementing report forecasting 191

Forecasting with OpenForecast 192 ✦ Implementing report forecasting features 192

6.3 Using XML-based reports 204

Understanding XML exporting 205 ✦ Exposing the report content as an RSS feed 205

6.4 Summary 2106.5 Resources 211

7 Managing the Reporting Services environment 215

7.1 Managing RS with the Report Manager 216

How the Report Manager works 216 ✦ Managing Report Server settings 219 ✦ Managing content 223 ✦ Managing report execution 230 ✦ Managing linked reports 240

7.2 Managing RS with the Web service 242

Understanding the Web service management API 242 Tracing calls to the SOAP API 242 ✦ Deploying reports programmatically 245 ✦ Batching methods together 249

7.3 Managing RS with the WMI provider 249

Understanding the WMI provider 250 ✦ Implementing an RS management console 251

Trang 14

7.4 Other ways to manage Reporting Services 253

Managing RS with the script host 253 ✦ Using other management utilities 254

7.5 Analyzing report execution 255

Analyzing the Report Server execution log 255 ✦ Analyzing trace log files 257

7.6 Summary 2597.7 Resources 259

8 Securing Reporting Services 260

8.1 Exploring Reporting Services role-based security 261

How Windows authentication works 262 ✦ Using role-based authorization 266 ✦ Managing role-based security with the Report Manager 272 ✦ Managing role-based security with the Web service 277

8.2 Understanding code access security 281

Defining code access terminology 281 ✦ Exploring the RS default security policy 285 ✦ Managing RS code access security 286

8.3 Best practices for securing reports 290

Filtering data 291 ✦ Using dynamic dataset queries 292 Implementing custom security models 294 ✦ Enforcing a secured connection to the Report Server 294

8.4 Summary 2958.5 Resources 295

9 On-demand report delivery 299

9.1 How RS provides on-demand report delivery 3009.2 URL-based report access 301

Understanding URL syntax 302 ✦ Requesting resources

by URL 303 ✦ Requesting reports by URL 305 ✦ Working with report commands 306 ✦ Working with the HTML Viewer 309 ✦ URL access in action 312

9.3 Web service-based report access 317

Requesting reports with SOAP 318 ✦ Rendering images 321 Handing report sessions 324 ✦ Automating the report generation process 327

Trang 15

9.4 Evaluating URL and Web service access options 331

Evaluating URL access 332 ✦ Evaluating Web service access 334 ✦ Choosing an integration approach 334

9.5 Summary 3359.6 Resources 336

10 Reporting for Windows Forms applications 337

10.1 Rich client wanted 338

Report-enabling rich clients 338 ✦ Using the Client-to-Report Server model 339 ✦ Using the Client-to-Façade-to-Report Server model 341

10.2 Introducing the Adventure Works Report Wizard 342

Designing the Report Wizard 343 ✦ The Report Wizard by-step 344

step-10.3 Behind the scenes of the Adventure Works Report Wizard 348

Implementing the application framework 349 ✦ Selecting reports 354 ✦ Dealing with snapshot reports 359 Handling report parameters 359 ✦ Specifying the export format 368 ✦ Confirming the report request 368

10.4 Enhancing application performance 370

Using in-memory caching 371 ✦ Using multithreading 372

10.5 Summary 37510.6 Resources 376

11 Reporting for web-based applications 377

11.1 Understanding web reporting 378

Reporting for intranet applications 378 ✦ Reporting for Internet applications 379 ✦ Reporting for extranet applications 382 ✦ Introducing the Adventure Works Web Reporter 383

11.2 Client-side reporting techniques 384

Requesting reports from hyperlinks 384 ✦ Creating write-back reports 388 ✦ Using HTTP-POST 390 ✦ Calling the RS Web service on the client side 392

11.3 Server-side reporting techniques 395

Using the ReportViewer control 396 ✦ Using the Adventure Works ReportViewer control 399 ✦ Reporting off application datasets 407 ✦ Business-to-consumer reporting 409

Business-to-business reporting 412

11.4 Summary 41411.5 Resources 415

Trang 16

12 Reporting for OLAP applications 416

12.1 Understanding OLAP 417

OLTP vs OLAP 417 ✦ How Reporting Services and Analysis Services compare 418 ✦ Understanding the OLAP storage model 419 ✦ Designing OLAP solutions 422

12.2 Implementing an OLAP solution: AW Data Miner 424

Implementing the data warehouse 426 ✦ Implementing the OLAP cube 427 ✦ Authoring OLAP-based reports with RS 440 ✦ Implementing AW Data Miner 443

12.3 Summary 45312.4 Resources 454

13 Enterprise reporting 456

13.1 Understanding enterprise reporting 457

Evaluating enterprise reporting 457 ✦ Introducing the Adventure Works Enterprise Reporter 458

13.2 Behind the scenes of the Adventure Works Enterprise Reporter 461

Implementing the Report Configuration Store 462 Implementing the presentation layer 463 ✦ Implementing the Enterprise Reporting Façade 466 ✦ Designing for

scalability 470

13.3 Implementing custom application authorization 472

Understanding the Windows Authorization Manager 472 Securing the AW Enterprise Reporter 478

13.4 Summary 48113.5 Resources 481

14 Subscribed report delivery 483

14.1 Understanding subscribed report delivery 484

Subscription-based reporting scenarios 484 ✦ The publisher design pattern 484 ✦ How the Reporting Services subscription-based model works 485

subscriber-14.2 Configuring subscribed report delivery 488

Creating a new subscription 489 ✦ Choosing the subscription type 490 ✦ Configuring delivery extensions 493

Managing subscriptions 495

14.3 Subscribed report delivery in action 497

“Pushing” reports via standard e-mail subscriptions 497 Archiving reports to a file share 499 ✦ Sending reports to a data- driven list of recipients 503 ✦ Triggering subscriptions programmatically 509

Trang 17

14.4 Summary 51314.5 Resources 513

15 Extending Reporting Services 517

15.1 Understanding Reporting Services extensibility 518

Understanding interface-based programming 518 ✦ Working with interface inheritance 519

15.2 Reporting off ADO.NET datasets with a custom dataset data extension 523

Design goals and tradeoffs 525 ✦ Authoring dataset-bound reports 526 ✦ Implementing the custom dataset

extension 533 ✦ Debugging dataset extensions 537

15.3 Distributing reports to Web services using custom delivery extensions 537

Design goals and tradeoffs 538 ✦ Using the custom delivery extension 539 ✦ Implementing the custom delivery extension 540 ✦ Debugging custom delivery extensions 544

15.4 Implementing custom security 546

Design goals and tradeoffs 549 ✦ Intranet reporting with custom security 550 ✦ Implementing the custom security extension 553 ✦ Debugging the custom security

extension 560

15.5 Using custom HTTP modules 560

The HTTP module design goals and tradeoffs 561 Implementing the custom HTTP module 561

15.6 Considerations for custom rendering extensions 56315.7 Summary 563

15.8 Resources 564

16 Performance and scalability 566

16.1 Understanding capacity planning 567

Capacity planning fundamentals 567 ✦ The capacity planning process 572

16.2 Capacity planning with Reporting Services in action 577

Determining requirements 577 ✦ Setting up the testing environment 580 ✦ Performance testing 584

Analyzing performance results 585 ✦ Identifying resource constraints 587 ✦ Eliminating resource constraints 589

Trang 18

16.3 Summary 59216.4 Resources 593

appendix Installing Reporting Services 594

A.1 Choosing components to install 595A.2 Selecting the service account 596A.3 Specifying RS virtual folders 597A.4 Configuring the Report Server database 599A.5 Configuring Reporting Services for e-mail delivery 600A.6 Setting up the RS samples 601

A.7 Configuring RS licensing mode 601A.8 Post-installation steps 603

Installing RS sample reports 603 ✦ Backing up the encryption key 604

A.9 Resources 604

index 605

Trang 20

Let me let you in on a little secret: creating software at Microsoft is pretty similar tocreating software at any other company I think many people’s perception is thatMicrosoft designs products by having an army of market researchers carefully exam-ining competitive products and surveying consumers to determine exactly what fea-tures to put in the next release

The reality is that most of the ideas that go into Microsoft products are the result

of small teams of people brainstorming in front of whiteboards or chatting in ways I’m not saying we don’t know what competitors are doing or what customersare asking for, but the process of translating real-world scenarios to requirements anddesigns is much more organic than you might think This flexible approach allowsteams to take a fresh look at existing problems as well as adapt to industry trends andcustomer demands

hall-Case in point: when we started building Reporting Services, we didn’t set out tocopy what other companies had already done Instead, we asked questions like “Whatdoes it mean to build an enterprise reporting product?” “How do we enable people tocreate powerful data visualizations without writing code?” and, most important of all,

“How can we build a platform that people can leverage in their own applications?” Theanswer to this final question ended up driving a major part of the product’s design.Building a platform is not something to be taken lightly It requires that you spendextra time factoring and documenting the interfaces between software components Itmeans that your components should not use any “back doors” that are not available

to other developers using the platform It also can change the order in which you build

the product—you have to focus on the nonvisual parts of the product before you work

on the user-facing ones For example, the Reporting Services report processing enginewas up and running about a year before the graphical report design tool was ready.During this time, report definition files had to be hand-coded in order to test any newreport processing features

The decision to build a platform also means that you will have to spend time oninfrastructure and interfaces at the expense of end-user features We knew that thistrade-off would mean the first version of Reporting Services might look less feature-richthan other more “mature” reporting products We felt like this was the right long-term

Trang 21

strategy, as a strong platform would enable others to fill the gaps instead of having towait for us to add every feature When asked about this approach, I sometimes posethe question, “Is it better to build a car with a powerful engine and fewer lights on thedashboard or one with lots of lights that can’t go anywhere?”

One decision we made for our new platform was to bet on another new platform:.NET As we had no legacy code to support, we decided early on to make ReportingServices a 100 percent NET application While this may seem like a no-brainer today,when we started building Reporting Services the CLR and the NET Framework hadnot yet been released Although building an enterprise-quality server product on such

a new technology stack was a little risky at the time, the decision has paid major idends in developer productivity and product quality

div-Ultimately, the barometer of whether we have succeeded is what our customers andpartners are able to build on the platform Since we released the first version of theproduct earlier this year, I have seen applications built by customers leveraging theReporting Services platform in ways I never imagined But a platform isn’t useful if

all developers don’t have the know-how to take advantage of it Because the product

is so new, detailed information and good examples have been sparse and hard to find.That’s where resources like Teo’s excellent book come in This book starts by pro-viding a solid foundation for using the built-in tools included with Reporting Servicesbut quickly takes you to the next level by focusing on the programmability and exten-sibility aspects of the product The focus on these parts of Reporting Services will helpyou leverage and extend the product feature set in your own applications Teo’sapproach is to provide real-world examples and useful scenarios that walk you throughthe details and give you new ideas to explore Teo has the ability to take complex topicsand break them into smaller sections that can be easily understood I enjoyed beingone of the book’s technical reviewers as I was able see how various parts of the productcame to life on the page I encourage you to use the ideas in this book and take Report-ing Services to the next level

BRIAN WELCKER

Group Program Manager Microsoft SQL Server Reporting Services

Trang 22

In archeology, the Rosetta stone was the key that solved the mysteries of Egyptianhieroglyphics I believe that with the release of Microsoft SQL Server 2000 ReportingServices, code-named Rosetta, Microsoft gives organizations the key they need tounlock the secrets of enterprise data and unleash the power hidden within

Looking retrospectively, Microsoft’s reporting strategy has been confusing, at leastfor me Microsoft Access debuted in the early 90s with a powerful report designer thatmade desktop reporting child’s play

Enterprise developers, however, have not been that lucky The lack of sive native reporting capabilities continues even today in the NET framework True,some progress has been made with the advent of print-related controls, such as Print-Document, PrintPreviewControl, and so on, but still, dealing with the GDI+ (Graph-ics Device Interface) API is usually the last thing a developer wants to tackle whencreating the next line-of-business application For reasons such as these, report-enabling Microsoft-centric solutions has been traditionally regarded as a tedious chore

comprehen-To address this problem, many of us defected to third-party tools Others chose tofill the void with homegrown, customized solutions While these solutions address par-ticular needs, they can also be costly, time-consuming, and difficult to implement

I remember with nostalgia a project that I worked on about five years ago It calledfor developing a reporting solution for a major Fortune 100 company I implementedthe solution as a server-based framework, following a design pattern similar to the onediscussed in chapter 13 I used Microsoft Access as a reporting tool to generate reportsand save them as snapshot files Once the report was ready, the Report Server woulde-mail it back to the user or send the user a link to the snapshot file

Implementing this solution was a lot of fun, but it took a significant developmenteffort I wouldn’t have had to do all of this if I had had Reporting Services back then.Instead of implementing a homegrown solution, I could have used RS to report-enablethe applications

For this reason, I was very excited when I heard about Reporting Services in late

2003 Finally, there was an easy way to report-enable different types of applications.Subsequently, I was involved in a project where I was able to confirm to myself that,indeed, RS was the reporting platform I had been dreaming about for years

Trang 23

To share my enthusiasm I decided to write a book about Reporting Services While

I contemplated what the book’s scope would be, it dawned on me that I could bringthe most value by following my heart and approaching Reporting Services from adeveloper’s point of view I put myself in a position that many developers could relate

to Here I am, a developer, consultant, and architect, who is tasked with adding ing features to a given application How would I go about this?

report-To answer this question, my book takes a solution-oriented approach, and morethan half of it is devoted to integrating different types of applications with RS As youread this book, you will discover a common pattern It starts by discussing the require-ments and design goals of a given reporting scenario Then it discusses the implemen-tation choices, and finally it explains how the solution is implemented

I firmly believe that a technical book should go beyond rehashing the product umentation I tried my best to follow this path and take up where the RS documenta-tion (which, by the way, is excellent) leaves off For this reason, my book should be used

doc-in conjunction with it When you read the book, you will notice that sometimes, when

I believe I can’t explain things any better, I refer you to the product documentation

Microsoft Reporting Services in Action is written for report authors, administrators, and

developers who need a detailed and practical guide to the functionality provided by RS

In the first half, report authors will master the skills they need to create versatile reports.Administrators will learn the ropes of managing and securing the report environment The second half of the book is primarily aimed at intermediate-to-advanced NETdevelopers who are planning to leverage RS to add reporting capabilities to their Win-dows Forms or web-based applications However, because of the service-orientedarchitecture of Reporting Services, the book will also benefit developers who targetother platforms but want to integrate their applications with RS

Microsoft SQL Server 2000 Reporting Services is a great piece of technology With

RS, report authors can create reports as easily as you would do it in Microsoft Access.Make no mistake, though RS is a sophisticated server-based platform, and its featureset goes well beyond that of a desktop reporting tool To use RS effectively, you need

to have a solid grasp of how it works and how it can be integrated with different types

of client applications I hope this book makes this endeavor easier

Trang 24

Writing this book has been a lot of fun and a lot of work Although you see only myname on the front cover, this book has been a team effort involving many people First and foremost, I would like to acknowledge my family for their kind support

in making this book a reality My wife, Elena, contributed directly to the book byhelping me recover what was lost in the process of translation To my family I owe mygreatest thanks

Thanks to the Reporting Services team at Redmond for giving us this great productand working hard to make it even more successful You can judge by yourself Microsoft’scommitment to customer satisfaction by looking at the number of messages answered byMicrosoft engineers on the RS discussion list (microsoft.public.sqlserver.reportingsvcs) Brian Welcker, Microsoft Group Product Manager for SQL Server Business Intel-ligence, has been phenomenal in helping me with my project on several fronts, includ-ing reviewing the book and providing valuable technical feedback, as well as writingthe foreword

Thanks go to several Microsoft engineers—Brian Hartman, Bryan Keller, DanielReib, and Tudor Trufinescu—for reviewing parts of this book Not only did these folksnot mind my constant pestering, but they were even more eager to help make this book

as technically accurate as possible

I am grateful to the Manning team for publishing Microsoft Reporting Services in Action and demanding my best to ensure that this book meets the highest standards.

Thanks to Dr Marjan Bace for giving a chance to an aspiring author Thanks to mydevelopment editors, Ann Navarro and Lianna Wlasiuk, for not losing faith that myincoherent writings could turn into something readable As project editor, Mary Pier-gies has been outstanding in orchestrating the production process My copy editors,Liz Welch and Linda Recktenwald, did a great job in polishing my manuscript Kudos

to my tech editor, Todd Meister, for verifying that the book is technically correct, and

to Susan Forsyth for proofreading the manuscript Thanks also to Dr Dave Robersonfor organizing the technical review process and to my technical reviewers, AlexzanderNepomnjashiy and Mark Monster, for reviewing the manuscript Thanks to thebook’s publicist, Helen Times, for getting the word out I am grateful to the rest ofthe Manning production team for their many contributions to this book

Trang 25

I must also acknowledge my coworkers from Extreme Logic, now part of theHewlett-Packard Enterprise Services group, for the productive and competitiveenvironment that I found so exciting and invigorating I consider myself very fortu-nate for having been part of this community for the past four years

There are a few other people who contributed indirectly to the book Thanks toSteven Gould for his Open Source OpenForecast package that I used in chapter 6 forthe report-forecasting example Thanks to Dino Esposito for his CodeDom sample.Kudos to Peter Bromberg for the ASP.NET menu control and to Christian Weyer forthe dynamic Web services invocation sample

My thanks also to the many unnamed developers for their altruistic support on the.NET discussion lists I admire your willingness to help Your contributions kept mesane during many dire moments in my career! Thanks also to Google for archiving thenewsgroup content and making it easily accessible

I would especially like to acknowledge my parents, Zlatka and Stefan Lachev, forsupporting me in my choice of studying computer engineering, despite the fact that

a career in medicine or in the army looked much more promising at the time

Finally, thank you for purchasing this book! I sincerely hope that you will find it

as enjoyable to read as it has been for me to write!

Thanks and happy reporting!

Trang 26

Part 1, “Authoring reports,” teaches you the skills that you will need as a reportauthor to create RS-based reports It encompasses chapters 2–6.

Chapter 2 focuses on discussing various options for authoring reports We start byexplaining the report-authoring process We continue by looking at how we canauthor reports with Visual Studio NET by using the Report Wizard and the ReportDesigner and by importing from Microsoft Access We also discuss how developerscan leverage the open nature of the report definition schema by creating reports pro-grammatically We conclude the chapter by mentioning two third-party tools that youcan use to author reports ad hoc or import them from Crystal Reports

Chapter 3 gets to the gist of the report-authoring process by teaching you how towork with report data It discusses the RS data architecture and shows you how towork with data sources, datasets, and report queries It emphasizes the role of param-eters and walks you through the steps for creating parameterized reports

Chapter 4 teaches you the practical skills needed for authoring different types ofreports with the Report Designer We create various report samples to complementour discussion, including tabular, freeform, chart, crosstab, subreports, and multicol-umn reports

Chapter 5 shows you how to use expressions and functions to extend your reportsprogrammatically It starts by emphasizing the role of expressions and how they can

be used to manipulate the report item properties It continues by giving you an depth understanding of the RS object model and its collections Next, we look at the

in-RS internal functions and how they can be leveraged to add interactive features to ourreports, such as reports with navigational features and document maps, as well as local-ized reports

Trang 27

Chapter 6 explains how you can supercharge the capabilities of your reports byusing embedded Visual Basic NET code and external code in the form of NET assem-blies It presents an end-to-end example that demonstrates how you can leverage cus-tom NET code to add forecasting features to your reports

Part 2, “Managing reports,” explains how report administrators can manage andsecure the report repository It includes chapters 7–8

Chapter 7 discuses different ways of managing the report catalog It starts byexplaining how report administrators can use the Report Manager to perform variousmanagement activities Then, it presents other management options, including usingthe RS Web service, WMI provider, RS script host, and other utilities

Chapter 8 teaches you how you can secure the report catalog It explores the RSrole-based security model and how it can be leveraged to enforce restricted access tothe Report Server Then, it explains how code access security works and how you canadjust it to grant permissions selectively to custom code

Part 3, “Delivering reports,” discusses how developers can integrate RS with ferent application scenarios This part includes chapters 9–14

dif-Chapter 9 provides an overview of the two application integration options availablewith RS, URL and Web service, and how they compare with each other

Chapter 10 teaches you the skills you need to report-enable WinForm-based cations It starts by discussing how RS can be leveraged with different applicationdesigns The chapter walks you through an end-to-end sample, the Report Wizard,that demonstrates various practical techniques that you can use to integrate this type

appli-of application with RS

Chapter 11 covers integrating RS with web-based applications It demonstrates ious techniques for generating reports on the client side and server side of the appli-cation Here, we create an enhanced version of the Report Viewer sample control thatfacilitates server-side web reporting

var-In Chapter 12, you learn how RS can be used in conjunction with OLAP for menting synergetic reporting solutions It walks you through the steps for creating a sampleAnalysis Services cube and implementing a WinForm front end with Office Web Com-ponents for generating dynamic and standard reports

imple-Chapter 13 shows how you can address some common enterprise reporting needs cifically, this chapter shows you how you can implement a façade layer that supports mul-tiple reporting providers In addition, it showcases a possible approach to implement anapplication-based security layer by leveraging the Windows 2003 Authorization Manager.Chapter 14 demonstrates how you can distribute reports via subscriptions It starts

Spe-by explaining how the RS subscribed-delivery process works Then, it looks at how youcan distribute reports via e-mail and file-share delivery extensions

Part 4, “Advanced reporting,” teaches you advanced techniques so you can makethe most out of Reporting Services It consists of chapters 15 and 16

Chapter 15 discusses the implementation details of three custom extensions thatyou can use to extend the features of RS It starts by implementing a custom dataset

Trang 28

extension to report off ADO.NET datasets Then, we discuss a custom delivery sion that can be used to distribute reports to an arbitrary Web service Next, we author

exten-a custom security extension Finexten-ally, we show how to plug in custom HTTP modules

to implement preprocessing tasks before the request reaches the Report Server.Chapter 16 shows you how to conduct a capacity-planning study to evaluate RS

in terms of performance and scalability You learn how to establish performance goals,how to create test scripts with the Application Center Test, and how to stress test yourReport Server installation You can apply the skills you harvest in this chapter for stresstesting not only the Report Server but any web-based application as well

Trang 29

source code

The book’s source code can be downloaded from Manning’s web site at http://www.manning.com/lachev The next sections discuss the software requirements for execut-ing the code and the steps to set it up

Instead of partitioning the source code on a per-chapter basis, we decided to solidate most of it in two applications: a WinForm-based AWReporterWin applicationand a web-based AWReporterWeb application This approach has several advantages,including the following:

con-• Simplifies the setup—For example, you need only one virtual folder to host theAWReporterWeb web application

• Allows the reader to launch the samples conveniently from a single application menu

• Simulates real-world applications—For example, you can encapsulate the codelogic in a set of common classes

The trade-off is that you may not have all the software dependencies required to pile the sample applications and you may run into compilation errors, as explained inthe next section

com-S OFTWARE REQUIREMENTS

Table 1 outlines the software requirements needed to run all code samples

Table 1 Software requirements

All

Microsoft Windows 2003

Server

For the Authorization Manager component

If you want to skip this sample, you can use Windows XP or Windows 2000.

13

Microsoft Visual Studio 2003

with NET Framework 1.1

Required by Reporting Services All

continued on next page

Trang 30

Some samples have more involved setup requirements For example, chapter 12requires the Office Web Components Primary Interop Assemblies (PIAs) to beinstalled, while chapter 13 requires the Authorization Manager (available only onWindows 2003 and Windows 2000 as a separate download) to be installed To pre-vent compilation errors because of missing external dependencies, we excluded thesource code for these two chapters, the AWReporterWin and AWReporterWebprojects, respectively Please follow the setup instructions found in the readme files inthe sample folders to run these samples successfully.

In case you still experience compilation errors as a result of missing external dencies, we suggest that you resolve the issue by excluding the samples For example,let’s say you don’t have Office 2003 and you can’t compile AWReporterWin To fixthis, right-click on the corresponding folder that contains the sample code in theVisual Studio NET 2003 Solution Explorer and choose the Exclude from Projectmenu item Then, compile the project and fix the compilation errors (if any) by com-menting out any references to the excluded code

depen-Microsoft SQL Server 2000 Required by Reporting Services You will

need to install the AdventureWorks2000 base from the RS Setup program

data-All

Microsoft Office 2003 For Office Web Components and Access

reporting You will also need to install the Office 2003 Primary Interop Assemblies (PIAs).

12, 13

DynWSLib The Dynamic XML Web Services Invocation

sample for invoking web services cally Can be downloaded for free from got- dotnet.com.

dynami-15

Microsoft WebService Behavior For invoking Web services on the client side

of a web application Can be downloaded for free from MSDN.

11

Application Center Test ACT is included with Visual Studio NET 2003 16

Analog Web Analyzer For analyzing IIS logs Can be downloaded for

free from http://www.analog.cx/.

16

Report Magic For reporting off analog files Can be

down-loaded for free from magic.org/.

http://www.report-16

Table 1. Software requirements (continued)

Trang 31

S ETTING UP THE SOURCE CODE

Once you download the source code archive, you can extract the zip file to any folder

of your hard drive Once this is done, the folders listed in table 2 will be created

Most of the code samples include readme files with specific step-by-step instructionsthat you follow to set up the code sample

Running the sample reports in Visual Studio NET

Perhaps most of you will be eager to run the sample reports immediately To execute thereports successfully under the Visual Studio NET Report Designer, follow these steps:

Step 1 Copy the AWC.RS.Library.dll and OpenForecast.dll to the Report Designer

binary folder, C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer

Step 2 Open the AWReporter.rptproj (found under the Reports folder) in Visual

Studio NET 2003

Step 3 Change the data source credentials of the AW2000 Shared DS data source by

double-clicking the AW2000 Shared DS.rds file and switching to the dentials tab Enter the user name and password of a database login that has atleast Read permissions to the tables in the AdventureWorks2000 database

Cre-Table 2 Source code folders

AWReporterWeb An ASP.NET web-based application that

demon-strates various web-based reporting techniques

You will need to set up an IIS virtual folder ing to this folder.

point-9, 10, 11, 12, 13, 15

AWReporterWin A WinForm-based application that demonstrates

how you can add reporting features to WinForm applications.

2, 7, 9, 10, 11, 12,13

AWReportViewer The enhanced version of the ReportViewer

sam-ple control for server-side web reporting.

11

Database A database projects that includes SQL scripts to

create stored procedures and views in the AdventureWorks2000 database

As dictated by the code sample setup instructions

Extensions Includes the custom data, delivery, and security

extensions.

15

OpenForecast The converted to J# OpenForecast package 6

Performance Testing Includes the test scripts for performance testing

Trang 32

At this point, you should be able to run most of the reports

Some reports require a more involved setup process For example, there are reportsthat require that additional assemblies, such as AWC.RS.Extensions.dll and AWC

RS.Library.dll, be configured properly The readme files that accompany the samplecode include specific step-by-step instructions about how to configure these assemblies

Deploying the reports to the Report Server

To run most of the code samples successfully, you need to deploy the sample reports

to the Report Server Assuming that you have Administrator rights to the report log, the easiest way to do this is to follow these steps:

cata-Step 1 Copy the AWC.RS.Library.dll and OpenForecast.dll to the Report Server

binary folder, C:\Program Files\Microsoft SQL Server\MSSQL\ReportingServices\ReportServer\bin This step is needed because some reports refer-ence these assemblies, and the deployment process will fail if these assembliesare not found in the Report Server binary folder

Step 2 If you haven’t done this already, copy the AWC.RS.Library.dll and

Open-Forecast.dll to the Report Designer binary folder C:\Program Files\MicrosoftSQL Server\80\Tools\Report Designer

Step 3 Open the AWReporter.rptproj project (found under the Reports folder) in

Visual Studio NET 2003

Step 4 Right-click the AWReporter project in the Visual Studio NET Solution

Explorer and choose Properties to open the project’s properties

Step 5 Verify that the TargetFolder setting is set to AWReporter and the

TargetServer-URL setting is set to http://<servername>/ReportServer, where <servername>

is the computer name where the Report Server is installed If RS is installedlocally, the TargetServerURL setting should be http://localhost/ReportServer

Step 6 Click the Configuration Manager button and verify that both the Build and

Deploy check boxes are selected for Debug configuration Click OK to miss the Property Pages dialog

dis-Step 7 Right-click the AWReporter project again and choose Deploy This will build

the reports and then deploy them to the report catalog

Step 8 To verify the setup, open the Report Manager web portal If RS is installed

locally, the default Report Manager URL will be http://localhost/reports.Under the Home folder, verify that the AWReporter folder exists Click itslink and run the Sales By Territory report If everything is okay, the reportwill render in the browser

Trang 33

Configuring the AWReporterWeb application

To configure the web-based samples, you need to set up the AWReporterWeb virtualfolder by following these steps:

Step 1 Right-click the AWReporterWeb folder in Windows Explorer and choose

Properties

Step 2 Select the Web Sharing tab.

Step 3 Click the Share This Folder radio button.

Step 4 In the Edit Alias dialog, enter AWR eporterWeb as an alias.

Step 5 Make sure that the Read Access Permission check box is selected and the

Scripts radio button is selected Click OK to close the Edit Alias dialog

Step 6 Open the Internet Information Manager (IIS) console Right-click the

AWReporterWeb folder, choose Properties, and then select the DirectorySecurity tab Click the Edit button in the Authentication and Access Controlpanel Uncheck the Enable Anonymous Access check box Make sure thatthe Integrated Windows Authentication check box is selected

Trang 34

author online

Your purchase of Microsoft Reporting Services in Action includes free access to a private

web forum run by Manning Publications, where you can make comments about thebook, ask technical questions, and receive help from the author and from other users

To access the forum and subscribe to it, point your web browser to www.manning.com/lachev This page provides information on how to get on the forum once you are regis-tered, what kind of help is available, and the rules of conduct on the forum

Manning’s commitment to our readers is to provide a venue where a meaningfuldialog among individual readers and between readers and the author can take place

It is not a commitment to any specific amount of participation on the part of theauthor, whose contribution to the AO remains voluntary (and unpaid) We suggestyou try asking the author some challenging questions, lest his interest stray! TheAuthor Online forum and the archives of previous discussions will be accessible fromthe publisher’s web site as long as the book is in print

A BOUT THE AUTHOR

Teo Lachev has more than 11 years of experience designing and developing centered solutions He currently works as a technology consultant for the EnterpriseApplication Services practice of Hewlett-Packard Teo is a Microsoft Certified Solu-tion Developer and Microsoft Certified Trainer He lives in Atlanta, Georgia

Microsoft-You can contact Teo through the Author Online forum, by sending him e-mail atteo@prologika.com, or by visiting his web site at http://www.prologika.com

Trang 35

about the title and cover

By combining introductions, overviews, and how-to examples, Manning’s In Action books are designed to help learning and remembering According to research in

cognitive science, the things people remember are things they discover during motivated exploration Although no one at Manning is a cognitive scientist, we areconvinced that for learning to become permanent it must pass through stages ofexploration, play, and, interestingly, re-telling of what is being learned Peopleunderstand and remember new things, which is to say they master them, only after

self-actively exploring them Humans learn in action An essential part of an In Action

guide is that it is example-driven It encourages the reader to try things out, to playwith new code, and explore new ideas

There is another, more mundane, reason for the title of this book: our readers arebusy They use books to do a job or solve a problem They need books that allow them

to jump in and jump out easily and learn just what they want, just when they want

it They need books that aid them in action The books in this series are designed for

such readers

A BOUT THE COVER ILLUSTRATION

The figure on the cover of Microsoft Reporting Services in Action is a “Giancataro,” who,

judging by his attire, might be a tradesman or basket weaver We know the illustration istaken from an Italian source estimated to be about 200 years old Our efforts to get atranslation of “Giancataro” have failed The first reader who correctly solves the puzzle

of what the word means will receive a free Manning book of his or her choice Pleasepost your translations to the Author Online forum at www.manning.com/lachev

We at Manning celebrate the inventiveness, the initiative, and the fun of the puter business with book covers based on the rich diversity of regional life of two cen-turies ago brought back to life by pictures assembled from various collections This was

com-a time when the dress codes of two regions sepcom-arcom-ated by com-a few dozen miles identifiedpeople uniquely as belonging to one or the other Dress codes have changed since thenand it is now often hard to tell the inhabitant of one continent from another Perhaps,trying to view it optimistically, we have traded a cultural and visual diversity for a morevaried and interesting personal, intellectual—and technical life

Trang 36

So much information, so little time the character “Poison Ivy” would likely say ifthe Batman saga was taking place in today’s enterprise.

We all know that the dot.com boom is history and so are the lavish IT budgets

In the doldrums of the economic recovery, organizations tend to spend their money

on streamlining internal processes to gain a competitive advantage According toMicrosoft, today’s information workers spend as much as 80 percent of their timegathering information, with only 20 percent left to analyze it and make a decision Inmany organizations, such requests consume significant IT and development resources.Too often, Excel spreadsheets are the prevalent reporting tools today and manual dataentry or “pencil-pushing” is among the top reasons for inaccurate data and wrongdecisions Aware of these issues, Microsoft initiated the Microsoft SQL Server 2000Reporting Services project at the beginning of the new millennium, with a bold vision

to “enable employees at all levels of an organization to realize the promise of BusinessIntelligence to promote better decision making.”

This chapter provides a panoramic view of Reporting Services (RS) Throughout the

rest of this book I will use the terms Reporting Services and RS interchangeably You will see

Trang 37

• Why RS is such a compelling choice for enterprise reporting

• The main parts of the RS architecture

• The report-generation process and report lifecycle

• The steps for creating your first RS report

Regardless of the alphabet soup of terms and acronyms that are popping up like daisiesalmost every day and that have probably become a part of your IT vocabulary—termssuch as BI (business intelligence), OLAP (online analytical processing), data mining,DSSs (decision support systems), EISs (executive information systems), digital dash-boards, enterprise portals, and enterprise data buses—the purpose of enterprise report-ing is to simply “get out” what was “put in.” Therefore, for many applications,reporting represents the last, and often most important, stage of the IT pipeline

To clarify the last point, let’s consider a typical scenario that RS can address tively Let’s say that an organization has built a web portal for submitting ordersonline As the business grows, the same organization may need to implement a report-ing infrastructure to analyze sales data and understand its business, for example, tofind out the top-selling products, customer demographics, and so forth To accom-plish this goal, the organization could leverage RS

effec-We use the term report to refer to the web-based or saved-to-file counterpart of a

standard paper-oriented report For example, an organization may want to give its tomers an option to generate various reports online—an Order History report, forinstance Web reporting has traditionally been difficult to implement Even more dif-ficult has been exporting reports to different file formats RS solve both problems ele-gantly, for two reasons First, out-of-the-box RS is web-enabled Second, most popularexport formats are natively supported

cus-1.1.1 Why do we need RS?

Ironically, despite the important role that reporting plays in today’s enterprise, creatingand distributing reports have been traditionally painstaking and laborious chores Tounderstand why we need RS, let’s analyze the reporting problem space

Table 1.1 lists some of the most pressing issues surrounding the reporting arenaand how RS addresses them

Table 1.1 How Microsoft RS deals with the reporting problem space

Reporting Need How RS addresses it?

Report authoring can be labor intensive By using the powerful Report Designer, you can author

reports as easily as you can with Microsoft Access Centralized report management is

Trang 38

Depending on your particular situation you may find other compelling reasons totarget RS as your reporting platform of choice We revisit the RS features throughoutthis chapter.

Supported report types

Your reporting requirements may call for authoring various types of reports that differ

in complexity For example, your users may request that a large report include a ument map for easy navigation RS lets you design a variety of report types, as listed intable 1.2

doc-Reports need to be distributed to

various destinations.

RS supports both on-demand and subscription-based reporting Reports can be requested on-demand by Win- Form and web-based applications Alternatively, reports can be distributed to a list of subscribers.

Reports often need to be exported

in different electronic formats.

RS supports many popular export formats out of the box.

Proprietary nature of reporting tools

doesn’t allow you to extend them

RS has a flexible architecture that allows you to extend

RS capabilities by writing custom code.

Reports need to be secured RS offers a comprehensive security model that

adminis-trators can leverage to enforce secured access to reports

by assigning users to roles When the default based authentication is not a good fit, it can be replaced with custom security implementations

Windows-Enterprise reporting solutions

can be costly.

To minimize cost, RS is bundled and licensed with SQL Server If you have a licensed copy of SQL Server 2000, you may run RS on the same server for no additional license fee

Table 1.2 RS supports various report types

Report Type Purpose Example

Tabular Displays data in a table format with a

fixed number or rows and columns.

Excel-type reports

Freeform Data regions are positioned arbitrarily

on the page by the report author.

Invoice-invoice details report

Chart Presents data graphically Employee performance chart

Crosstab (matrix) Data is rotated to present row data as

columns.

A report that shows products on rows and time on columns

Drilldown Includes expandable sections A company performance crosstab

report where product can be expanded by category and brand

continued on next page

Table 1.1 How Microsoft RS deals with the reporting problem space (continued)

Reporting Need How RS addresses it?

Trang 39

Although most popular reporting tools support many of the report types shown intable 1.2, RS makes the report-authoring process as easy as working with MicrosoftAccess reporting functionality For example, report authors can drag and drop items todefine the report’s appearance

Now that we understand what RS is, let’s see how it fits in the Microsoft BI vision

1.1.2 How is RS implemented?

Microsoft released version 1.0 of RS at the beginning of 2004 as an add-on toMicrosoft SQL Server 2000 At a very high level, RS can be defined as a server-basedplatform for authoring, managing, and distributing reports We discuss the RS archi-tecture in more detail in a moment For now, note that RS is integrated with andrequires several other Microsoft products, including:

• Windows 2000 or above as a server operating system

• Microsoft SQL Server 2000 (with Service Pack 3a) and above

• Internet Information Server (IIS) 5.0 or above

• .NET Framework 1.1

• Visual Studio .NET 2003 for report authoring and testing

For more information about installing RS, please refer to appendix A

hyper-Interactive Includes interactive features, such as

document maps, hyperlinks, on-demand sections, and so forth.

visible-Adobe Acrobat–type reports with ument maps on the left side

doc-Table 1.2 RS supports various report types (continued)

Report Type Purpose Example

Table 1.3 RS supports editions to meet various reporting needs

Edition Choose when…

Standard You need to install RS on a single computer The Standard edition doesn’t support

clustered deployment to load-balance multiple RS instances.

Enterprise You need all RS features, including load balancing

Developer You have to integrate RS with client applications or extend its capabilities by writing

.NET code The Developer edition supports the same feature set as the Enterprise edition, but it is for use as a test and development system, not as a production server Evaluation You need to evaluate RS The Evaluation edition expires after 120 days.

Trang 40

For more information about how the RS editions differ, refer to the product tation or the “Reporting Services Features Comparison” section in the RS official web-site at http://microsoft.com/sql/reporting/productinfo/features.asp

documen-For information about RS licensing requirements, visit the “How to LicenseReporting Services” page at http://www.microsoft.com/sql/reporting/howtobuy/howtolicensers.asp

1.1.3 RS and the Microsoft BI platform

RS is positioned as an integral part of Microsoft’s business intelligence (BI) platform.This platform is a multiproduct offering whose goal is to address the most commondata management and analysis challenges that many organizations face every day, such

as analyzing vast volumes of data, trend discovery, data management, and of course,comprehensive reporting

During the RS official launch presentation on January 27, 2004, Paul Flessner,Microsoft senior vice president of Enterprise Services, outlined the place of RS in theMicrosoft BI platform offering, as shown in figure 1.1

Table 1.4 outlines the purpose of the major building blocks within the Microsoft

BI platform

Most of you have probably used more than one of these products in the past tosolve your data management and analysis needs Indeed, most of them have beenaround for a while What was missing was a product for authoring, managing, and

Figure 1.1 The Microsoft BI platform consists of several products layered on top

of the SQL Server database engine and addresses various data management and

reporting needs.

Ngày đăng: 06/07/2014, 15:19

TỪ KHÓA LIÊN QUAN