Creating a Report Manually Using Reports Builder

25
Creating a Report Manually Using Reports Builder Purpose In this tutorial, you learn how to create a report manually, first building the data model and then defining the layout for the data model. Time to Complete Approximately 1 hour Topics This tutorial covers the following topics: Overview Scenario Prerequisites Creating a Data Model using the Data Wizard Creating a Paper Layout for the Data Model Generating Report Output to a PDF File Summary Related information Viewing Screenshots Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: Because this action loads all screenshots simultaneously, response time may be slow depending on your Internet connection.) Note: Alternatively, you can place the cursor over each individual icon in the following steps to load and view only the screenshot associated with that step. Overview A report definition, or module, consists of objects that collectively define a report. Two key components in a report definition are the data model and the layout. The data model is a relational model that defines the data to be fetched from the data source(s), the values to be computed, and the order in which the data should appear in a report. Reports Builder objects that define the data model are queries, groups, columns, parameters, and links. The layout contains the formatting information about how the data should appear in the output. Layout objects include repeating frames, frames, fields, boilerplate, and anchors. With Reports Builder, you can create a new report using the Report Wizard, or create a new report manually. Using the Report Wizard, you are guided through the steps to build a report for both Web and paper layouts: creating a new report definition, defining the data model, and specifying a layout. To learn more about creating a report using the Report Wizard, see the tutorial Creating a Report Using the Report Wizard. When you choose to create a new report manually, Reports Builder creates a new default report definition for you. You then create the data model and layout separately. In this tutorial, you will create a new report manually. You will learn how to use the Data Wizard to create a query for the data model. Then you will learn how to define a paper layout for the data model using the Report Block Wizard. Back to Topic List

description

Oracle reports building

Transcript of Creating a Report Manually Using Reports Builder

  • 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:;