Creating a Report Manually Using Reports Builder

Post on 26-Sep-2015

37 views 3 download

description

Oracle reports building

transcript

  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    CreatingaReportManuallyUsingReportsBuilder

    Purpose

    Inthistutorial,youlearnhowtocreateareportmanually,firstbuildingthedatamodelandthendefiningthelayoutforthedatamodel.

    TimetoComplete

    Approximately1hour

    Topics

    Thistutorialcoversthefollowingtopics:

    OverviewScenarioPrerequisitesCreatingaDataModelusingtheDataWizardCreatingaPaperLayoutfortheDataModelGeneratingReportOutputtoaPDFFileSummaryRelatedinformation

    ViewingScreenshots

    Placethecursoroverthisicontoloadandviewallthescreenshotsforthistutorial.(Caution:Becausethisactionloadsallscreenshotssimultaneously,responsetimemaybeslowdependingonyourInternetconnection.)

    Note:Alternatively,youcanplacethecursorovereachindividualiconinthefollowingstepstoloadandviewonlythescreenshotassociatedwiththatstep.

    Overview

    Areportdefinition,ormodule,consistsofobjectsthatcollectivelydefineareport.Twokeycomponentsinareportdefinitionarethedatamodelandthelayout.Thedatamodelisarelationalmodelthatdefinesthedatatobefetchedfromthedatasource(s),thevaluestobecomputed,andtheorderinwhichthedatashouldappearinareport.ReportsBuilderobjectsthatdefinethedatamodelarequeries,groups,columns,parameters,andlinks.Thelayoutcontainstheformattinginformationabouthowthedatashouldappearintheoutput.Layoutobjectsincluderepeatingframes,frames,fields,boilerplate,andanchors.

    WithReportsBuilder,youcancreateanewreportusingtheReportWizard,orcreateanewreportmanually.UsingtheReportWizard,youareguidedthroughthestepstobuildareportforbothWebandpaperlayouts:creatinganewreportdefinition,definingthedatamodel,andspecifyingalayout.TolearnmoreaboutcreatingareportusingtheReportWizard,seethetutorialCreatingaReportUsingtheReportWizard.

    Whenyouchoosetocreateanewreportmanually,ReportsBuildercreatesanewdefaultreportdefinitionforyou.Youthencreatethedatamodelandlayoutseparately.

    Inthistutorial,youwillcreateanewreportmanually.YouwilllearnhowtousetheDataWizardtocreateaqueryforthedatamodel.ThenyouwilllearnhowtodefineapaperlayoutforthedatamodelusingtheReportBlockWizard.

    BacktoTopicList

    javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    Scenario

    Inthistutorial,youwillcreateareportforaninternationalcompany.Thereportwilldisplaydepartmentandemployeeinformationforthecompany'sregionalfacilitieslocatedineachcountry.

    BacktoTopicList

    Prerequisites

    Beforestartingthistutorial,youshould:

    1. HaveaccesstoorhaveinstalledOracleReportsDeveloper.2. Haveaccesstoorinstalledthesampleschema.ThistutorialusestheHRschemaincludedintheOracle10g

    database.3. DownloadreportsOBE.zipandunzipintoyourworkingdirectory.

    BacktoTopicList

    CreatingaDataModelUsingtheDataWizard

    Tobeginthistutorial,youwillcreateanewreportmoduleandusetheDataModelWizardtodefineyourquery.Specifically,youwillaccessQueryBuilderfromthewizardtogenerateaquerywithmultipletables,restrictthedatareturnedbyaddingaconditiontothequery,sortthedata.

    BacktoTopicList

    1. Ifitisnotalreadyopen,startOracleReportsbyclickingtheReportsBuildericononyourdesktop.Thewelcomescreendisplays.SelecttheoptionBuildanewreportmanually.ClickOK.

    IfReportsBuilderisalreadyopen,createanewreportbyselectingFile>New>Reportfromthemenu.

    javascript:;http://www.oracle.com/technology/obe/oberpt904/CreatingRptManually/files/reportsOBE.zip
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    SelecttheoptionBuildanewreportmanually.ClickOK.

    Inbothcases,theDataModelviewoftheReportEditordisplays.

    2. TheDataModelviewisaworkareainwhichyoucreate,define,andmodifydatamodelobjectstobeusedinyourreport.Datamodelobjectsincludequeries,groups,columns,parameters,andlinks.ReportsBuilderusesthedatamodeltodeterminewhatdatatoretrieveforthereport.

    AddaquerytothedatamodelbyselectingInsert>Queryfromthemenu.ThisactioninvokestheDataWizard.

    javascript:;javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    ClickNext.

    3. ReportsBuilderassignsadefaultnametoeachqueryyoubuildwiththeDataWizard.GiveyourqueryameaningfulnamebyenteringDepartments_QueryintheQuerynamefield.

    javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    BesurethattheMatrixquerycheckboxiscleared.ClickNext.

    4. Forthedatasource,acceptSQLQueryasthedatasourcetypebyclickingNext.

    javascript:;javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    5. Onthedatasourcedefinitionpage,clickConnecttoconnecttothedatabase.

    IntheConnectdialogbox,enterHRfortheUserName,HRforthePassword,andthenameofyourdatabasefortheDatabasefield.

    Note:IfyouwerepreviouslyworkinginthisReportsBuildersessionusingadifferentschema,youwillhavetoconnecttotheHRschemainordertocompletethistutorial.

    6. TheDataSourcedefinitiondialogboxdisplays.YoucannowtypeinaSQLstatement,defineaqueryvisuallyusingQueryBuilder,orimportanexistingfile.

    Forthistutorial,youwilluseQueryBuildertodefineyourquery.QueryBuilderisaneasytousedataaccesstoolthatprovidesalogicalandintuitivemeanstoaccessinformationfromyourorganization'sdatabasesforanalysisandreporting.YoucanuseQueryBuildertodefinealmostanyquerythatyouwouldbuildusingaSQLSELECTstatement.QueryBuilderautomaticallygeneratestheappropriateSELECTFROM[table.column]clausebasedoncolumnsdisplayedintheQueryBuilderworkspace.

    ClicktheQueryBuilderbuttontodefineyourquery.TheQuerydialogboxdisplays,asdoesawindowdisplayingthedatatables,views,snapshots,andsynonymstowhichyouhaveaccess.

    javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    SelecttheEMPLOYEEStablefromthelistoftables.ClickInclude.ClickClose.AgraphicalrepresentationoftheEmployeestabledisplaysintherightpaneloftheQuerydialogbox.ThispanelistheDataSourcepanel.

    javascript:;javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    7.TheDepartments_Querywillcontainseveraltables.ClicktheSelectRelatedTablesicon ontheQueryBuildericonbartodisplaytablesrelatedtotheEmployeestable.

    SelecttheHR.DEPARTMENTStable.

    ClickIncludeandthenclickClose.AgraphicalrepresentationoftheDepartmentstableisaddedtotheDataSourcepanel,andtheprimarykey/foreignkeyrelationshipsbetweenthetwotablesareshown.

    javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    8. NowdisplaythetablesinthedatabasethatarerelatedtotheDEPARTMENTStable.Withthefocusonthe

    DEPARTMENTStable,clicktheSelectRelatedTablesicon .

    SelecttheHR.LOCATIONStable.

    ClickIncludeandthenclickClose.AgraphicalrepresentationoftheLOCATIONStableisaddedtotheDataSourcepanelandtheprimarykey/foreignkeyrelationshipbetweentheDEPARTMENTSandLOCATIONStablesisshown.

    javascript:;javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    9. Includeonemoretableinthisquery.WiththefocusontheLOCATIONStable,clicktheSelectRelatedTablesicon

    .

    SelecttheHR.COUNTRIEStable.

    ClickIncludeandthenclickClose.AgraphicalrepresentationoftheCOUNTRIEStableisaddedtotheDataSourcepanelandtheprimarykey/foreignkeyrelationshipbetweentheLOCATIONSandCOUNTRIEStablesisshown.

    javascript:;javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    10. Nowthatyouhaveselectedthetablesforthequery,chooseandorderthecolumnsthatwillappearinthereport.

    SelecttheColumnSequenceicon fromtheiconbarinQueryBuilder.

    TheColumnSequencedialogboxdisplaysalltheavailablecolumnsintheleftpanel,andthedisplayedcolumnsintherightpanel.Noticethatthecolumnsareprefixedwiththeirrespectivetablenames.

    SelectDEPARTMENTS.DEPARTMENT_NAMEfromtheAvailableColumnslistandclickthe>>Copy>>buttontomovethecolumntotheDisplayedColumnslist.Asanalternative,youcandoubleclickthecolumnnametomovethecolumntotheDisplayedColumnslist.

    RepeatthisprocessforEMPLOYEES.FIRST_NAME,EMPLOYEES>LAST_NAME,EMPLOYEES.SALARY,LOCATIONS.CITY,COUNTRIES.COUNTRY_NAME,andEMPLOYEES.HIRE_DATE.

    javascript:;javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    ClickOK.

    11. Next,youwanttoensurethatthedatareturnedfromthequeryissortedbythecolumnDEPARTMENT_NAME.

    SelecttheSorticon intheiconbarinQueryBuilder.TheSortdialogboxdisplays.

    SelectDEPARTMENTS.DEPARTMENT_NAMEfromtheAvailableColumnslistandclickthe>>Copy>>buttontomovethecolumntotheSortedColumnslist.Asanalternative,youcandoubleclickonthecolumnnametomovethecolumntotheSortedColumnslist.

    NowhighlightDEPARTMENT_NAMEintheSortedColumnslistandensurethattheAscendingoption,thedefaultvalueforSortingOrder,isselected.NoticethearrowtotheleftofDEPARTMENT_NAME.AnupwardsarrowindicatesAscendingsortorder,whileadownwardsarrowindicatesDescendingsortorder.

    javascript:;javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    ClickOK.

    12. Forthisreport,youwanttodisplaydataforthoseemployeeshiredafterJanuary1,1990.Torestrictthedata

    retrievedfromthedatabase,youcanuseQueryBuildertoaddaconditiontothequery.

    Thusfarinthetutorial,youhaveworkedintheDataSourcepanelontherightsideoftheQuerydialogbox.NowyouwillworkintheConditionspanelontheleft.

    IntheQuerywindow,clicktheblankconditionsfieldintheConditionspanel.

    Next,clickHIRE_DATEintheEMPLOYEEStable.ThisactioncausesthecolumnEMPLOYEES.HIRE_DATEtobeenteredintotheconditionfield.

    javascript:;javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    Completetheexpressionbyenteringthecriteria:EMPLOYEES.HIRE_DATE>'01JAN90'.Besuretoincludethesinglequotationmarks.

    Finally,clicktheAccepticon whenyouaresatisfiedwiththeconditionexpression.

    13. You'vecompletedthedefinitionofthequeryforthisreport.ClickOK.TheresultingSQLstatementisdisplayedforyou.

    javascript:;javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    ClickNext.

    14. Forthisreport,youwillgroupdepartmentandemployeeinformationbycountry.

    SelectCOUNTRY_NAMEintheAvailableFieldslistandclick[>]tomoveittotheGroupsFieldslist.

    ClickNext

    javascript:;javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    15. Youdonothavetocalculateanytotalsforthisreport.ClickNext.

    You'vecompletedthedefinitionofyourdatamodelforthisreport.ClickFinish.AgraphicalrepresentationofyourdatamodeldisplaysintheDataModelviewoftheReportEditor.Noticethehierarchicalstructureofthedatamodel:themastergroupisG_COUNTRY_NAMEandthedetailgroup,containingdepartmentandemployeeinformation,isG_DEPARTMENT_NAME.

    16. SaveyourreportasDepartmentsReport_.jsp.

    Tosaveareportdefinition,clicktheSaveicon inthetoolbar,orselectFile>Savefromthemenu.Thefirsttimeyousaveyourreportdefinition,theSavedialogboxdisplays,givingyoutheopportunitytoenterameaningfulnameforyourreport.

    javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    ClickSave.

    BacktoTopicList

    CreatingaPaperLayoutfortheDataModel

    NowthatyouhavedefinedthedatamodelforthereportusingtheDataWizard,youwillcreatealayouttospecifyhowthedatashoulddisplayinthereport.

    Inthispartofthetutorial,youwillworkwiththePaperLayoutviewoftheReportEditor.Youwilladdareportblocktothelayout.Areportblockautomaticallyinsertsthedatamodelandbusinesslogicintothereport.Eachtimethereportisrun,thereportblockdynamicallypullsthedatadefinedbythedatamodelintoyourreport.

    BacktoTopicList

    1.SelectthePaperLayouticon ontheReportEditortoolbartoinvokethePaperLayoutview.

    SelectInsert>ReportBlockfromthemenu.TheReportBlockWizarddisplays.

    javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    Note:TheReportBlockWizardisverysimilartotheReportWizard.Youcanspecifyatitleandreportstyle,selectthegrouporgroupsasdesired,selectthefieldsyouwanttodisplayinthereport,modifythelabels,andchooseatemplate.However,theReportBlockWizardenablesyoutoretaintheexistingpaperandWeblayoutsdefinedfortheparticulardatamodel,while,atthesametime,enhanceboth.IfyouinvoketheReportWizardfromthePaperLayoutview,however,youwilloverwriteallpaperandWeblayoutspecificationspreviouslydefinedforthereport.AnotherfeatureoftheReportBlockWizardisthatitenablesyoutoincludemultipledatablocksinasinglereport.

    2. EnterareporttitleofDepartmentsReportandchooseGroupAboveasthereportstyle.

    javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    ClickNext.

    3. Younowselectthegroup(s)youwanttodisplayinyourreportandthedirectioninwhichtherecordsshouldrepeat.

    Yourdatamodelcontainstwogroups,onecontainingcountryinformationandtheothercontainingdepartmentandemployeeinformation.

    SelectG_COUNTRY_NAMEfromtheAvailableGroupslistandclicktheDown>button.ThismovesthemastergrouptotheDisplayedGroupslist.

    Repeatthesameactionforthedetailgroup,G_DEPARTMENT_NAME.

    javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    ClickNext.

    4. Younowneedtodecideonthefieldsyouwanttodisplayinthereport.FromtheAvailableFieldslist,select

    COUNTRY_NAMEandclickthe[>]button.RepeatthisprocessforCITY,FIRST_NAME,LAST_NAME,SALARY,HIRE_DATE,andDEPARTMENT_NAMEfields.

    Ensurethatthedisplayedfieldsareintheordershownbelow.Youcandraganddropafieldtomodifytheorder.

    javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    ClickNext.

    5. Onthenextpanelofthewizard,youcanmodifythedefaultlabelsandwidths.Forthistutorial,keepthedefaultsas

    theyare.

    ClickNext.

    javascript:;javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    6. AsthefinalstepintheReportBlockWizard,youcanincludeatemplateinthereportdefinition.Templatesallowyoutocreateastandardlookandfeel,andalsopromotereusability.Inthistutorial,youwilluseoneofthepredefinedtemplatesforyourreport.

    SelectBeigefromthePredefinedtemplatelist.

    ClickFinish.You'vesuccessfullycreatedthepaperlayoutforyourdatamodel.

    SaveyourreportdefinitionbyclickingSave inthetoolbar.

    javascript:;javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    7.Topreviewthepaperlayout,clicktheRunPaperLayouticon onthetoolbar,orselectProgram>RunPaperLayoutfromthemenu.

    ThepaperlayoutforyourDepartmentsReportdisplaysinthePaperDesignview.

    BacktoTopicList

    GeneratingReportOutputtoaPDFFile

    ReportsBuildercangeneratereportoutputtoaPDFfile,containingtheformatteddataandallobjects.WhenyougenerateyourreportoutputtoaPDFfile,youcandistributetheoutputtoanyPDFdestination,includingemail,printer,OracleASPortal,andWebbrowser.

    1. SelectthereportintheObjectNavigator.

    javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    2. SelectFile>GeneratetoFile>PDFfromthemenu.SaveyourreportoutputasDepartmentsReport_.pdf,suchasDepartmentsReport_sk.pdf.

    BacktoTopicList

    Summary

    Inthislesson,you'velearnedhowto:

    CreateadatamodelusingtheDataWizardCreateapaperlayoutforthedatamodelGeneratereportoutputtoaPDFfile

    javascript:;javascript:;
  • 5/6/2015 CreatingaReportManuallyUsingReportsBuilder

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

    BacktoTopicList

    RelatedInformation

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

    BacktoTopicList

    Placethecursoroverthisicontohideallscreenshots.

    http://www.oracle.com/technology/products/reports/index.htmljavascript:;