Tải bản đầy đủ - 0 (trang)
Chapter 16. Ad Hoc Reporting New in 2005

Chapter 16. Ad Hoc Reporting New in 2005

Tải bản đầy đủ - 0trang

IssuesFacingAdHocReporting

Thechallengeindoingthiskindofanalysishasoftenbeenwith

thetechnology.Technologistssuchasreportdevelopersare

usuallykeenonSQLandtheirreportingtools.Theyknowthe

insandoutsofrelationaldatabases,thedifferentkindsofjoins,

andtheconceptsbehindOLAP.Theymightormightnotbeso

keenonthebusinessandrepercussionsofcertaintrends.

Theoppositeismostlikelytrueforbusinessanalysts.The

typicalanalystknowswhathewantstoseeoratleasthasa

theorythathewantstocollectdatafortoproveordisprove.

Analystsmightnotknoworcarethattogetatypicalsales

order,hemustjoinsixorseventablestogether.Analystsare

nottechnologists.

Whattheanalystneedsisaflexible,yetpowerfultooltobuild

hisownreportsanddohisownanalysiswithoutoverbearing

technicalterms.







Client-sideReportingwithSSRS

SSRSattemptstoaddresstheseissueswithtwomaintools,

ReportBuilderandModelDesigner.

Beforeausercancreateaclient-sidereport,ananalystor

technologistmustcreateareportmodel.Thereportmodelis

builtwiththeaidofVisualStudio,andcontainsmetadataabout

theunderlyingdatabase.

Thepurposeofthemetadataistodescribetherelationships

betweenthevarioustablesintheRDBMSintermsofentities,

attributes,andrelationships(roles),whichcanthenbeusedby

ReportBuilderuserstohelpthembuildadhocreports.

ThishelpstoabstracttheDBMSintobusinessobjectsthatthe

nontechnologistshouldrecognize.

ThesecondpartoftheequationistheactualReportBuilder.

TheReportBuilderisthetoolusedtocreateadhocreports.

ItisaWindowsforms-based.NETapplicationthatcanbe

accessedthroughaURL(usingthe

http:///reportserver/reportbuilder/reportbuilder.application

URL,whereisthenameofthecomputerthatis

runningReportServer)orfromReportManager(usingthe

http:///reportsURLandthenclickingReport

Builder).

ReportBuilderusesthereportmodeltopresenttheenduser

withtheabstractedviewofbusinessobjects.AlthoughReport

Builderisapowerfulreport-developmentapplication,Visual

Studioprovidesmanymorefeaturesforreportdevelopersand

isrequiredtobuildmodelsforReportBuilder'sconsumption.







ReportModelsandtheModelDesigner

Aspreviouslymentioned,thefirststepincreatingend-user

reportsisthecreationofthereportmodel.Themodeliswritten

inadeclarativelanguagecalledSemanticDefinitionModel

Language(SDML).TheSemanticDefinitionModelLanguageis

basedontheUnifiedModelingLanguage(UML),anditcontains

manyofthesameparadigms.ItissimilartotheRDLinthatit

isanXML-basedcommunicationslanguage.Thereportmodel

abstractstheRDBMSintobusinessobjectstheenduserwould

recognize.

Tobeeffectivefortheenduser,themodelauthormustinclude

somekeypiecesofinformationaboutthedatabase.Thistypeof

informationincludesthefollowing:

Amapoftablenamesandcolumnnamesintobusiness

objects

Informationabouttherelationshipsbetweentablesthat

wouldotherwisebestoredinprimarykeysorforeignkeys

Hierarchicalinformationorlogicalgroupingsaboutyour

objects

Permissionsforuserstoseeobjects

FromReportBuilder,themodelaidstheuserinselectingwhat

informationshewantstosee,and,consequently,buildingthe

queryforthedatasourceoftheresultingreport.

Tobuildthesemodels,modeldevelopersmustuseatoolcalled

ModelDesigner.LikeReportDesigner,itisbuiltintoVisual

Studio/BusinessIntelligenceDevelopmentStudio.Thetemplate



projecttypeiscalled"ReportModelProject."Modelscanbe

generatedagainstSQLServerorAnalysisServices



Note

ModelDesignerand,subsequently,ReportBuilder

canonlybuildreportsagainstSQLServerorAnalysis

Services.Tobuildreportsforotherdatasources,

suchasOracle,youcanemploylinkedserversorthe

unifieddatamodel(UDM).Bothprovideathin

abstractionlayer.



Developerscangeneratemodelsintwoways.Thefirstwayto

generatemodelsisbasedonasetofpreexistingrules.Thisis

thewaythewizardandtheautogeneratefunctionalitywork.

Theotherwayistoconnectusingadatasource,andstart

designingthemodelbyhand.

Youwilltakealookatbothmethodslaterinthischapter.



ReportModelProjects

Aspreviouslymentioned,reportmodelprojectsarewhatthe

ModelDesignerusestogeneratemodels.Therearethreekinds

offilesthatitusestogeneratemodels.Thesefilescorrelateto

themajorstepsinmodelsgeneration.Thefirstkindoffileisthe

DataSource(.ds).

ThesecondtypeoffileistheDataSourceview.TheData

Sourceviewprovidesthemodelinformationaboutthe

underlyingdatastore.Itiskindoflikeanentityrelationship

diagram,inthatitprovidesinformationaboutthedatabase

schema,butiswritteninXML.ThemodelusestheDataSource

viewtoquerythedatabase,makingtheDataSourceviewthe

bridgebetweenthemodelandthedatasource.Thefinaltypeof

fileistheactualmodelfile(.sdml).Themodelcanonly

referenceonedatasource,andoneDataSourceview.



ModelFileContent

Areportmodelcontainsthreemainsections:

SemanticmodelsAcollectionofbusinessobjectsinterms

familiartoabusinessanalyst.

Thesemanticmodelalsocontainstherelationshipsofthese

businessobjectstooneanother.

PhysicalmodelTheoutlineofthedatabaseschema.This

containsinformationaboutthetablesandviewsinthedata

source.

BindingsThemapbetweenthephysicalmodelandthe

semanticmodel.

ThedatasourceandDataSourceviewareusedtomakeupthe

physicalmodel.Thesemanticmodelisacombinationofthe

physicalmodelalongwithsemanticobjectsandbindings.



Entities

Thefirstoftheseobjectsiscalledanentity.Theentityisreally

thecruxofthesemanticmodelbecauseitmapstablesand

views.

Anentitycanmaptomultipletablesorviews,anditselfhasa

collectionofobjectscalledattributes,expressions,folders,and

sourcefields.Entitiesshouldhavenamesthatarerecognizable

toabusinessanalyst.Forexample,insteadoftheobscuretable

nametbl_sls_ordr,theentitywouldbenamedSalesOrder.



AsyouaddrelationalitemstotheDataSourceview,youcan

maptheseitemsintoentities.Thebindingpropertyoftheentity

tellsReportBuilderthetable(s)orview(s)towhichtheentity

refers.



Roles

Inaway,rolestakeusbacktoDatabaseDesign101.Roles

storeinformationabouttherelationshipbetweenentities.The

relationshipinformationisbasicallythecardinalitybetweenthe

objects.Thiscanbeonetoone,onetomany,ormanytomany.

Asanexample,astoreentitycanhaveonlyoneaddress,

whereasacustomercanhavemanyorders.Rolesalsocontain

informationaboutwhichattributesineachentityarethe

definingonesintermsofthecardinalityrelationship.So,ifthe

AddressIDfieldonthestoreentityiswhatyouneedtoobtainthe

properaddressdatafromtheaddressentity,thentherolethat

containsinformationabouttherelationshipstoringthatAddressID

isthefieldtousetocorrelatethetwoentities.

Endusersseetherelationshipsplayoutwhenbrowsingentities

inReportBuilder.RolesarealsowhatenabletheinfinitedrilldownfeatureinReportBuilder.



SourceFieldsandExpressions

Ifrolescontaininformationabouttheprimaryandforeign

fields,sourcefieldscontaininformationaboutthecolumns.A

sourcefieldisanattributethatmapstoatablecolumnand

givesthecolumnafriendlyname.Sourcefieldscanonlybe

addedaftertheparententity'sbindingpropertyhasbeenset.

Forexample,LastNameonthePersontablecouldbeasourcefield

onthepersonentity.



Expressionsshouldhaveafamiliarringtothem.Expressionsin

areportmodeltakeoneormoresourcefields,andmanipulate

themwithfunctions,operators,and/orconstantstoderivea

calculatedvalue.Theseexpressionsarejustlikeexpressionsin

ReportDesigner.TheyarebasedonVB.NET,andautomatically

provideaccesstoSystem.MathandSystem.Convert.Functionsfrom

theMicrosoft.VisualBasicnamespaceandreferencestoother

assembliesorcustomcodecanbeusedaswell.

Agoodexampleofwhatcouldbeanexpressionisthe

combinationofFirstNameandLastNametocreateanewfieldcalled

Name.



Folders

Foldersallowyoutogroupcollectionsofentities.Folderscan

alsocontainotherfoldersandperspectives.Foldersallowyouto

addhierarchicalinformationtothemodel.Folderscanalsobe

usedtogroupitemstogetherregardlessofhierarchical

relationships.Forexample,becauseReportBuilderuserscan

navigatefoldersinamannersimilartoWindowsExplorer,you

canmoveinfrequentlyuseditemsintoafoldertohidethem

fromtheusers.



Perspectives

Perspectiveshelptogiveusanarrowervieworaviewofa

subsetofthemodel.Per-spec-tivescanhelplimituserstosee

onlyinformationtowhichtheyhaveaccess.Forexample,a

companymighthaveamodelthatcontainsinformationabout

allthefinancialdataitemsforthatcompany.Oneofthethings

perspectivescanhelpusdoistolimitwhatbudgetary

informationuserscanseetoonlyinformationabouttheir

department'sbudgets.



Perspectivesarecontainedinthemodel,andthemodel

designersandwizardsdon'tcreatethemforyou.Theyhaveto

bemanuallycreatedandmodelitemsmustbeplacedinthem.

Perspectivescancontainothermodelobjects,suchasentities

folders,roles,sourcefields,andexpressions.Justbyplacing

itemsintoaperspectivedoesnotexcludethemfromtherestof

themodels.Itemscanstillbeplacedinotherfoldersand

perspectives.



CreatingaModelProject

Tocreateamodel,youneedtocompleteafewsteps.Thefirst

istocreateareportmodelproject.Then,yougivetheprojecta

datasourceandaDataSourceview.Finally,youcancreatethe

models.Inthefollowingsteps,youcreateamodelbasedonthe

AdventureWorkscatalog:

1. Createanewproject.OpenVisualStudioorBusiness

IntelligenceDevelopmentStudio.ClickFileandthenNew

Project.

2. Inthedialogboxthatopens,ifnotselectedbydefault,

selectBusinessIntelligenceProjectsunderProjectTypes.

3. UnderTemplatesintherightpaneintheactivedialogbox,

selectReportModelProject.

4. Calltheproject"FirstModel"andchangethelocationto

C:\rs2005.MakesureCreateDirectoryforSolutionis

checked.SeeFigure16.1.



Figure16.1.Creatingnewbusinessintelligence

projects.



[Viewfullsizeimage]



CreatingaDataSource

Nowthatyouhaveanemptyproject,thenextthingtodois

connectittoadatasource.Rememberthedatasourcehasto

beSQLServer(orabstractedthroughlinkedserversorUDM).

UnlikeReportDesigner,nootherdatasourcesareaccepted

directly:

1. OpenSolutionExplorerandright-clickontheDataSources

folder.ClickAddNewDataSource.ThislaunchestheNew

DataSourceWizard.

2. SkipthewelcomepagebyclickingNext.



3. Onthenextpage,selectCreateaDataSourceBasedonan

ExistingorNewConnection,andthenclickNew.

4. Enter"localhost"asthenameoftheservertoconnectto.

5. SelectWindowsAuthentication.

6. IntheSelectorEnteraDatabaseNamelist,select

"AdventureWorks."

7. ClickTestConnection;ifyougetanOKdialogbox,click

OK.Ifnot,trytoresolvetheerrorusingthedebug

informationgiven,andthentryagain.

8. ClickOK.Atthispoint,youshouldhaveascreenthatlooks

similartoFigure16.2.



Figure16.2.Definingtheconnection.



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Chapter 16. Ad Hoc Reporting New in 2005

Tải bản đầy đủ ngay(0 tr)

×