Sunteți pe pagina 1din 25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

CreatingaReportManuallyUsingReportsBuilder
Purpose
Inthistutorial,youlearnhowtocreateareportmanually,firstbuildingthedatamodelandthendefiningthelayoutforthedata
model.

TimetoComplete
Approximately1hour

Topics
Thistutorialcoversthefollowingtopics:
Overview
Scenario
Prerequisites
CreatingaDataModelusingtheDataWizard
CreatingaPaperLayoutfortheDataModel
GeneratingReportOutputtoaPDFFile
Summary
Relatedinformation

ViewingScreenshots

Placethecursoroverthisicontoloadandviewallthescreenshotsforthistutorial.(Caution:Because
thisactionloadsallscreenshotssimultaneously,responsetimemaybeslowdependingonyourInternet
connection.)
Note:Alternatively,youcanplacethecursorovereachindividualiconinthefollowingstepstoloadandviewonlythe
screenshotassociatedwiththatstep.

Overview
Areportdefinition,ormodule,consistsofobjectsthatcollectivelydefineareport.Twokeycomponentsinareportdefinition
arethedatamodelandthelayout.Thedatamodelisarelationalmodelthatdefinesthedatatobefetchedfromthedata
source(s),thevaluestobecomputed,andtheorderinwhichthedatashouldappearinareport.ReportsBuilderobjectsthat
definethedatamodelarequeries,groups,columns,parameters,andlinks.Thelayoutcontainstheformattinginformation
abouthowthedatashouldappearintheoutput.Layoutobjectsincluderepeatingframes,frames,fields,boilerplate,and
anchors.
WithReportsBuilder,youcancreateanewreportusingtheReportWizard,orcreateanewreportmanually.Usingthe
ReportWizard,youareguidedthroughthestepstobuildareportforbothWebandpaperlayouts:creatinganewreport
definition,definingthedatamodel,andspecifyingalayout.TolearnmoreaboutcreatingareportusingtheReportWizard,
seethetutorialCreatingaReportUsingtheReportWizard.
Whenyouchoosetocreateanewreportmanually,ReportsBuildercreatesanewdefaultreportdefinitionforyou.Youthen
createthedatamodelandlayoutseparately.
Inthistutorial,youwillcreateanewreportmanually.YouwilllearnhowtousetheDataWizardtocreateaqueryforthedata
model.ThenyouwilllearnhowtodefineapaperlayoutforthedatamodelusingtheReportBlockWizard.
BacktoTopicList

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

1/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

Scenario
Inthistutorial,youwillcreateareportforaninternationalcompany.Thereportwilldisplaydepartmentandemployee
informationforthecompany'sregionalfacilitieslocatedineachcountry.
BacktoTopicList

Prerequisites
Beforestartingthistutorial,youshould:
1.
2.
3.

HaveaccesstoorhaveinstalledOracleReportsDeveloper.
Haveaccesstoorinstalledthesampleschema.ThistutorialusestheHRschemaincludedintheOracle10g
database.
DownloadreportsOBE.zipandunzipintoyourworkingdirectory.
BacktoTopicList

CreatingaDataModelUsingtheDataWizard
Tobeginthistutorial,youwillcreateanewreportmoduleandusetheDataModelWizardtodefineyourquery.Specifically,
youwillaccessQueryBuilderfromthewizardtogenerateaquerywithmultipletables,restrictthedatareturnedbyaddinga
conditiontothequery,sortthedata.

BacktoTopicList

1.

Ifitisnotalreadyopen,startOracleReportsbyclickingtheReportsBuildericononyourdesktop.Thewelcome
screendisplays.SelecttheoptionBuildanewreportmanually.ClickOK.

IfReportsBuilderisalreadyopen,createanewreportbyselectingFile>New>Reportfromthemenu.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

2/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

SelecttheoptionBuildanewreportmanually.ClickOK.

Inbothcases,theDataModelviewoftheReportEditordisplays.
2.

TheDataModelviewisaworkareainwhichyoucreate,define,andmodifydatamodelobjectstobeusedinyour
report.Datamodelobjectsincludequeries,groups,columns,parameters,andlinks.ReportsBuilderusesthedata
modeltodeterminewhatdatatoretrieveforthereport.
AddaquerytothedatamodelbyselectingInsert>Queryfromthemenu.ThisactioninvokestheDataWizard.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

3/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

ClickNext.

3.

ReportsBuilderassignsadefaultnametoeachqueryyoubuildwiththeDataWizard.Giveyourquerya
meaningfulnamebyenteringDepartments_QueryintheQuerynamefield.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

4/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

BesurethattheMatrixquerycheckboxiscleared.ClickNext.
4.

Forthedatasource,acceptSQLQueryasthedatasourcetypebyclickingNext.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

5/25

5/6/2015

5.

CreatingaReportManuallyUsingReportsBuilder

Onthedatasourcedefinitionpage,clickConnecttoconnecttothedatabase.
IntheConnectdialogbox,enterHRfortheUserName,HRforthePassword,andthenameofyourdatabasefor
theDatabasefield.

Note:IfyouwerepreviouslyworkinginthisReportsBuildersessionusingadifferentschema,youwillhaveto
connecttotheHRschemainordertocompletethistutorial.
6.

TheDataSourcedefinitiondialogboxdisplays.YoucannowtypeinaSQLstatement,defineaqueryvisually
usingQueryBuilder,orimportanexistingfile.
Forthistutorial,youwilluseQueryBuildertodefineyourquery.QueryBuilderisaneasytousedataaccesstool
thatprovidesalogicalandintuitivemeanstoaccessinformationfromyourorganization'sdatabasesforanalysis
andreporting.YoucanuseQueryBuildertodefinealmostanyquerythatyouwouldbuildusingaSQLSELECT
statement.QueryBuilderautomaticallygeneratestheappropriateSELECTFROM[table.column]clausebasedon
columnsdisplayedintheQueryBuilderworkspace.
ClicktheQueryBuilderbuttontodefineyourquery.TheQuerydialogboxdisplays,asdoesawindowdisplaying
thedatatables,views,snapshots,andsynonymstowhichyouhaveaccess.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

6/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

SelecttheEMPLOYEEStablefromthelistoftables.ClickInclude.ClickClose.Agraphicalrepresentationofthe
EmployeestabledisplaysintherightpaneloftheQuerydialogbox.ThispanelistheDataSourcepanel.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

7/25

5/6/2015

7.

CreatingaReportManuallyUsingReportsBuilder

TheDepartments_Querywillcontainseveraltables.ClicktheSelectRelatedTablesicon
BuildericonbartodisplaytablesrelatedtotheEmployeestable.

ontheQuery

SelecttheHR.DEPARTMENTStable.

ClickIncludeandthenclickClose.AgraphicalrepresentationoftheDepartmentstableisaddedtotheData
Sourcepanel,andtheprimarykey/foreignkeyrelationshipsbetweenthetwotablesareshown.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

8/25

5/6/2015

8.

CreatingaReportManuallyUsingReportsBuilder

NowdisplaythetablesinthedatabasethatarerelatedtotheDEPARTMENTStable.Withthefocusonthe
DEPARTMENTStable,clicktheSelectRelatedTablesicon

SelecttheHR.LOCATIONStable.

ClickIncludeandthenclickClose.AgraphicalrepresentationoftheLOCATIONStableisaddedtotheData
Sourcepanelandtheprimarykey/foreignkeyrelationshipbetweentheDEPARTMENTSandLOCATIONStablesis
shown.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

9/25

5/6/2015

9.

CreatingaReportManuallyUsingReportsBuilder

Includeonemoretableinthisquery.WiththefocusontheLOCATIONStable,clicktheSelectRelatedTablesicon
.
SelecttheHR.COUNTRIEStable.

ClickIncludeandthenclickClose.AgraphicalrepresentationoftheCOUNTRIEStableisaddedtotheData
Sourcepanelandtheprimarykey/foreignkeyrelationshipbetweentheLOCATIONSandCOUNTRIEStablesis
shown.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

10/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

10. Nowthatyouhaveselectedthetablesforthequery,chooseandorderthecolumnsthatwillappearinthereport.
SelecttheColumnSequenceicon

fromtheiconbarinQueryBuilder.

TheColumnSequencedialogboxdisplaysalltheavailablecolumnsintheleftpanel,andthedisplayedcolumns
intherightpanel.Noticethatthecolumnsareprefixedwiththeirrespectivetablenames.

SelectDEPARTMENTS.DEPARTMENT_NAMEfromtheAvailableColumnslistandclickthe>>Copy>>buttonto
movethecolumntotheDisplayedColumnslist.Asanalternative,youcandoubleclickthecolumnnametomove
thecolumntotheDisplayedColumnslist.
RepeatthisprocessforEMPLOYEES.FIRST_NAME,EMPLOYEES>LAST_NAME,EMPLOYEES.SALARY,
LOCATIONS.CITY,COUNTRIES.COUNTRY_NAME,andEMPLOYEES.HIRE_DATE.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

11/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

ClickOK.

11. Next,youwanttoensurethatthedatareturnedfromthequeryissortedbythecolumnDEPARTMENT_NAME.
SelecttheSorticon

intheiconbarinQueryBuilder.TheSortdialogboxdisplays.

SelectDEPARTMENTS.DEPARTMENT_NAMEfromtheAvailableColumnslistandclickthe>>Copy>>buttonto
movethecolumntotheSortedColumnslist.Asanalternative,youcandoubleclickonthecolumnnametomove
thecolumntotheSortedColumnslist.

NowhighlightDEPARTMENT_NAMEintheSortedColumnslistandensurethattheAscendingoption,thedefault
valueforSortingOrder,isselected.NoticethearrowtotheleftofDEPARTMENT_NAME.Anupwardsarrow
indicatesAscendingsortorder,whileadownwardsarrowindicatesDescendingsortorder.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

12/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

ClickOK.

12. Forthisreport,youwanttodisplaydataforthoseemployeeshiredafterJanuary1,1990.Torestrictthedata
retrievedfromthedatabase,youcanuseQueryBuildertoaddaconditiontothequery.
Thusfarinthetutorial,youhaveworkedintheDataSourcepanelontherightsideoftheQuerydialogbox.Now
youwillworkintheConditionspanelontheleft.
IntheQuerywindow,clicktheblankconditionsfieldintheConditionspanel.

Next,clickHIRE_DATEintheEMPLOYEEStable.ThisactioncausesthecolumnEMPLOYEES.HIRE_DATEtobe
enteredintotheconditionfield.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

13/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

Completetheexpressionbyenteringthecriteria:EMPLOYEES.HIRE_DATE>'01JAN90'.Besuretoincludethe
singlequotationmarks.
Finally,clicktheAccepticon

whenyouaresatisfiedwiththeconditionexpression.

13. You'vecompletedthedefinitionofthequeryforthisreport.ClickOK.TheresultingSQLstatementisdisplayedfor
you.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

14/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

ClickNext.

14. Forthisreport,youwillgroupdepartmentandemployeeinformationbycountry.
SelectCOUNTRY_NAMEintheAvailableFieldslistandclick[>]tomoveittotheGroupsFieldslist.

ClickNext
http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

15/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

15. Youdonothavetocalculateanytotalsforthisreport.ClickNext.
You'vecompletedthedefinitionofyourdatamodelforthisreport.ClickFinish.Agraphicalrepresentationofyour
datamodeldisplaysintheDataModelviewoftheReportEditor.Noticethehierarchicalstructureofthedata
model:themastergroupisG_COUNTRY_NAMEandthedetailgroup,containingdepartmentandemployee
information,isG_DEPARTMENT_NAME.

16. SaveyourreportasDepartmentsReport_<your_initials>.jsp.
Tosaveareportdefinition,clicktheSaveicon
inthetoolbar,orselectFile>Savefromthemenu.Thefirsttime
yousaveyourreportdefinition,theSavedialogboxdisplays,givingyoutheopportunitytoenterameaningful
nameforyourreport.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

16/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

ClickSave.

BacktoTopicList

CreatingaPaperLayoutfortheDataModel
NowthatyouhavedefinedthedatamodelforthereportusingtheDataWizard,youwillcreatealayouttospecifyhowthe
datashoulddisplayinthereport.
Inthispartofthetutorial,youwillworkwiththePaperLayoutviewoftheReportEditor.Youwilladdareportblocktothe
layout.Areportblockautomaticallyinsertsthedatamodelandbusinesslogicintothereport.Eachtimethereportisrun,the
reportblockdynamicallypullsthedatadefinedbythedatamodelintoyourreport.
BacktoTopicList
1.

SelectthePaperLayouticon

ontheReportEditortoolbartoinvokethePaperLayoutview.

SelectInsert>ReportBlockfromthemenu.TheReportBlockWizarddisplays.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

17/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

Note:TheReportBlockWizardisverysimilartotheReportWizard.Youcanspecifyatitleandreportstyle,select
thegrouporgroupsasdesired,selectthefieldsyouwanttodisplayinthereport,modifythelabels,andchoosea
template.However,theReportBlockWizardenablesyoutoretaintheexistingpaperandWeblayoutsdefinedfor
theparticulardatamodel,while,atthesametime,enhanceboth.IfyouinvoketheReportWizardfromthePaper
Layoutview,however,youwilloverwriteallpaperandWeblayoutspecificationspreviouslydefinedforthereport.
AnotherfeatureoftheReportBlockWizardisthatitenablesyoutoincludemultipledatablocksinasinglereport.
2.

EnterareporttitleofDepartmentsReportandchooseGroupAboveasthereportstyle.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

18/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

ClickNext.
3.

Younowselectthegroup(s)youwanttodisplayinyourreportandthedirectioninwhichtherecordsshouldrepeat.
Yourdatamodelcontainstwogroups,onecontainingcountryinformationandtheothercontainingdepartmentand
employeeinformation.
SelectG_COUNTRY_NAMEfromtheAvailableGroupslistandclicktheDown>button.Thismovesthemaster
grouptotheDisplayedGroupslist.
Repeatthesameactionforthedetailgroup,G_DEPARTMENT_NAME.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

19/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

ClickNext.
4.

Younowneedtodecideonthefieldsyouwanttodisplayinthereport.FromtheAvailableFieldslist,select
COUNTRY_NAMEandclickthe[>]button.RepeatthisprocessforCITY,FIRST_NAME,LAST_NAME,SALARY,
HIRE_DATE,andDEPARTMENT_NAMEfields.
Ensurethatthedisplayedfieldsareintheordershownbelow.Youcandraganddropafieldtomodifytheorder.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

20/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

ClickNext.
5.

Onthenextpanelofthewizard,youcanmodifythedefaultlabelsandwidths.Forthistutorial,keepthedefaultsas
theyare.

ClickNext.
http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

21/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

6.

AsthefinalstepintheReportBlockWizard,youcanincludeatemplateinthereportdefinition.Templatesallow
youtocreateastandardlookandfeel,andalsopromotereusability.Inthistutorial,youwilluseoneofthe
predefinedtemplatesforyourreport.
SelectBeigefromthePredefinedtemplatelist.

ClickFinish.You'vesuccessfullycreatedthepaperlayoutforyourdatamodel.

SaveyourreportdefinitionbyclickingSave

inthetoolbar.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

22/25

5/6/2015

7.

CreatingaReportManuallyUsingReportsBuilder

Topreviewthepaperlayout,clicktheRunPaperLayouticon
Layoutfromthemenu.

onthetoolbar,orselectProgram>RunPaper

ThepaperlayoutforyourDepartmentsReportdisplaysinthePaperDesignview.

BacktoTopicList

GeneratingReportOutputtoaPDFFile
ReportsBuildercangeneratereportoutputtoaPDFfile,containingtheformatteddataandallobjects.Whenyougenerate
yourreportoutputtoaPDFfile,youcandistributetheoutputtoanyPDFdestination,includingemail,printer,OracleAS
Portal,andWebbrowser.
1.

SelectthereportintheObjectNavigator.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

23/25

5/6/2015

2.

CreatingaReportManuallyUsingReportsBuilder

SelectFile>GeneratetoFile>PDFfromthemenu.SaveyourreportoutputasDepartmentsReport_<your
initials>.pdf,suchasDepartmentsReport_sk.pdf.

BacktoTopicList

Summary
Inthislesson,you'velearnedhowto:
CreateadatamodelusingtheDataWizard
Createapaperlayoutforthedatamodel
GeneratereportoutputtoaPDFfile
http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

24/25

5/6/2015

CreatingaReportManuallyUsingReportsBuilder

BacktoTopicList

RelatedInformation
TolearnmoreaboutOracleReports10g,refertotheadditionalReportsOBEs.
VisittheOTNWebsitefortechnicalpapers,presentations,frequentlyaskedquestions,demonstrations,andmore.

BacktoTopicList

Placethecursoroverthisicontohideallscreenshots.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/rpt/r904/creatingrptmanually/manual_rpt.html

25/25

S-ar putea să vă placă și