56
Reports Aisha AlArfaj 1

Reports

Embed Size (px)

DESCRIPTION

Reports. Aisha AlArfaj. Using Reports Developer. Oracle Reports Developer is a robust tool to help in the creation of database applications. T here are generally a finite number of ways to enter information into the database, there are an infinite number of ways to retrieve it. - PowerPoint PPT Presentation

Citation preview

1

ReportsAisha AlArfaj

2

Using Reports Developer•Oracle Reports Developer is a robust tool to

help in the creation of database applications. •There are generally a finite number of ways

to enter information into the database, there are an infinite number of ways to retrieve it.

• It is important to have a firm understanding of Reports Developer and how it can decrease the amount of time it takes to create reports.

3

Creating Your First Report•Creating a report with Reports Developer is

very similar to creating a form with Forms Developer.

•In this example, you leverage as many of the built-in wizards as possible to make the task easy.

•The welcome dialog for Report Builder (shown in Figure 2.9).

•As with Form Builder, you have the option of manually creating a report or using Report Wizard.

4

FIGURE 2.9The Report Builder welcome dialog allows you to manually create a report or use the Report Wizard to help you.

5

•You can see the title and style definition page, as shown in Figure 2.10. Enter “Reports Demo” as the title for this example.

•In the title and style definition page there are various styles of reports with a thumbnail image next to each one of what the completed report will look like.

• To help you understand the various types of reports, here are some definitions:

Creating your first Report

6

FIGURE 2.10The Report Wizard allows you to define the title and style of your report.

7

•Tabular

•Form-like

•Mailing Label

•Form Letter

•Group Left.

•Group Above.

•Matrix

•Matrix with Group

Types of reports

• Will be explained more in next lecture.

8

• After entering Report Demo for the title and selecting the Tabular layout style, click the Next button.

• You are now asked to enter a SQL statement.• If the report uses more than one table, it is best to

use the Query Builder tool.• Because your sample report uses only a table, you

manually enter the SQL query as: SELECT * FROM table_name• you are asked to define the columns displayed on

the report, as shown in Figure 2.11. • Click on the >> button to select all columns to be

displayed. • By selecting one column at a time and pressing the

> button, you can control the order in which the columns appear in the report.

9

FIGURE 2.11The Report Wizard allows you to specify the columns from the table that will be displayed in the report.

10

•You are asked to calculate totals for any given column.

•Although total implies addition, you also have the options of averages, maximums, minimums, counts, and percentage totals.

• In the example, it would be nice to see the total salaries for everyone in the company, so click on SAL in the Available Fields list and move it to the Totals list using the Sum > button.

•You can specify labels and widths as shown in Figure 2.12.

11

FIGURE 2.12The Report Wizard allows you to specify labels on the report that are different than the database column names.

12

• Sometimes the developers at Oracle create the tables without using very descriptive column names. They use shorter name.

• Unfortunately, this does not make the report easy to read.

• Change some of the labels to be more descriptive.• Then, you are ready to choose a report template. • Several predefined templates are included in

Report Builder, or you can create your own.• Then, You can see the congratulations page

telling you that the Report Wizard is done asking you questions and is ready to generate your report.

• Click on Finish and the report is run and displayed to you as shown in Figure 2.13.

13

FIGURE 2.13The Live Previewer window gives you an idea of what your report will look like.

14

Building Complex Reports• It is rare that the person creating the report is also the

person responsible for printing and distributing the report. • Therefore, Oracle has built-in some features to help make

reports easy to produce.• As with Forms Developer, Reports Developer has a

runtime component if you want to deploy a report using the client/server model.

• A common method of running reports in this environment is to have a form call the runtime report engine and execute your report.

• You also can have reports run from icons on your desktop.

15

Creating a Master-Detail Report Using Report Builder•To have a master-detail report use group. •For example, Use Group Left layout.•Then, You can specify the SQL query

statement.•Most application developers who have spent

much time writing SQL statements will feel comfortable entering the SQL query by hand.

•However, using the Query Builder reduces the possibility for mistakes.

•After the SQL statement has been created, you have the ability to fine-tune it.

16

FIGURE 4.1The dialog to specify tables used in the query for the report.

• In the Query Builder you will see the dialog asking to specify the tables for the query as shown in Figure 4.1.

17

•You will be using the EMP and DEPT tables for this report.

•Select the DEPT table in the dialog and click the Include button.

•Do the same for the EMP table, and then click the Close button.

•This should add the table definitions to the Query Builder tool as shown in Figure 4.2.

• In the Query Builder tool you can see that the relationship between the DEPT and EMP tables is shown with a line from the DEPTNO column in the EMP table pointing back to the DEPTNO column in the DEPT table.

18

FIGURE 4.2The DEPT and EMP table definitions in the Query Builder tool.

19

•The Query Builder tool provides you some important visual information about the columns in the tables that you use for the report.

•Notice the primary keys DEPTNO and EMPNO are both highlighted with the bold font.

• Notice also that there is a data type symbol to the right of each of the column names. EMPNO is a number, as indicated by the icon . ENAME is a character column, as represented by the icon ; and HIREDATE is a date as shown by the icon .

20

•you have the ability to specify the columns that will appear in the report.

• Click the check box to the left of each of the column names to have the column appear on the report.

• The only column from the DEPT table to display is DNAME.

•All the columns except DEPTNO should be displayed from the EMP table. When you are done, click OK.

21

ORDER OF COLUMNS

•The order in which you check the columns is the order in which they will be displayed on your report.

•So, if you want the ENAME column to appear before EMPNO, click ENAME first. Don’t worry if you don’t get the order correct.

• The Report Wizard allows you to reorder them at a later time.

22

• The Query Builder tool is complete and has filled in the SQL statement that will be used for the report. The SQL query in the Layout Wizard is shown in Figure 4.3.

FIGURE 4.3The SQL statement as completed by the Query Builder.

23

•It is relatively easy to create queries with the Query Builder tool when the database is set up correctly.

•After generated SQL statement. •You can now have the option to decide

which column will differentiate the groups of employees.

• This report uses the Department name or the DNAME column.

•Select it and move it to the Group Fields list by using the > button. Now click Next.

24

•Then, you can specify the columns that will be displayed as fields on the report.

•After that, You are given the chance to add a predefined formula to your list.

•The report specifies salary totals for each of the various departments.

•Select SAL from the Available Fields list and then click Sum > to create a salary total in the Totals list, as shown in Figure 4.4.

25

FIGURE 4.4Adding salary totals for each of the departments for the report.

26

•You can modify some of the layout characteristics such as labels, heights, and widths.

•Then, you can choose a template•Now you are finished with the Report

Wizard.•The Report Editor should display the

finished result shown in Figure 4.5.

27

FIGURE 4.5The Report Editor in Live Previewer view showing the completed report after running the Report Wizard.

28

Using the Re-entrant Layout Wizard•The report in Figure 4.5 looks a bit wide.

There is probably a better layout format that could be used instead.

•Rather than trying to re-create everything, simply rerun the Report Wizard and choose a different layout.

•This can be done by selecting Tools, Report Wizard from the menu.

29

•When you rerun the Report Wizard, you will notice a tab bar appears at the top of the wizard dialog.

•The different tabs give you access to the various screens you filled out when first running the wizard.

•Because all that needs to be changed is the layout, make sure that the Style tab is selected as shown in Figure 4.6.

30

FIGURE 4.6The Style attributes when rerunning the Report Wizard.

31

Using the Report Editor

•you can use the Report Editor to modify the report so that it is easier to read.

•The Report Editor can be used to clean up reports.

•Although these functions can be taken care of with the Report Wizard, it is generally easier to use the Report Editor because you can see all of the changes interactively.

32

The Report Editor Toolbar

•Some useful tools to help you format the report are found on the toolbars. Figure 4.9 shows the upper toolbar with the name of each tool. Short descriptions of each tool follow the figure.

FIGURE 4.9The upper toolbar.

33

•New open new report•Open Opens an existing report.•Save Saves the current report that you

are working on.•Print Prints the current report.•Mail E-mails the current report.•Connect To connect to a database•Cut •Copy •Paste •Undo and redo

34

•Run web layout brings up a web browser with the report within it.

•Run paper layout give you the Paper Design view.

•Help Invokes the Oracle Developer help system. On Windows, the standard Help system is used. On Unix, the Help system is HTML based.

35

•Data Model Changes the mode of the Report Editor to show the data model. It is helpful to show the table relationships used in the report. This is discussed more in Chapter 9, “More About Reports.”

•Web source displays the source code for your JSP-based Web report, including HTML, JSP, and XML tags.

•Paper Layout Model Changes the mode of the Report Editor to show an abbreviated model layout for your report. It can be helpful when there are different layouts for a report with lots of rows displayed.

36

•Paper Design The default mode for the Report Editor. It allows you to see how the report will look using live data from the tables.

•Paper Parameter Form Brings up a parameter form editor to allow you to create a parameter form for the report.

37

•First Page Goes to the first page of the report.

•Previous Page Goes to the previous page of the report.

•Next Page Goes to the next page of the report.

•Last Page Goes to the last page of the report.

•Page Number Description Displays the current page in Live Previewer mode.

38

•From menu bar (insert) You can:▫ Insert Date and Time Inserts a field on the report that

displays the date and time the report was last run.▫Insert Page Number Inserts page numbers on the

report.•Figure 4.10 shows the lower toolbar with

short descriptions. The descriptions are explained following the figure.

•FIGURE 4.10•The lower toolbar.

39

• Font The font name used for any selected text object in the Report Editor.

• Font Size The font size used for any selected text object in the Report Editor.

• Bold Toggles the font for any selected text object between the bold and nonbold version of the font. It can be used together with the Italic and Underline buttons.

• Italic Toggles the font for any selected text object between the italic and nonitalic version of the font. It can be used together with the Bold and Underline buttons.

• Underline Toggles an underlining rule underneath any selected text object. It can be used together with the Bold and Italic buttons.

40

•Start Justify Lines up selected objects in the report to begin at the common left border.

•Center Justify Lines up selected objects in the report to the common middle.

•End Justify Lines up selected objects in the report to end at the common right border.

•Flush Justify Adds appropriate spacing so that selected objects in the report have common left and right borders.

•Currency Formats a data field to display as currency (using the currency symbol for the current local).

•Percent Formats a data field to display as a percentage including the percent symbol.

41

•Commas Formats a numeric data field to contain commas.

•Add Decimal Places Formats a numeric data field to display decimal places.

•Remove Decimal Places Removes decimal places from a numeric data fields.

42

FIGURE 4.11The sample report you are working on, completed to this point.

43

The Report Editor Tool Palette•The Report Editor also contains a Tool

Palette similar to the one found in the Forms Editor. Because a report is static, or noninteractive, the Tool Palette does not contain as many objects. Figure 4.12 shows the Tool Palette found in the Live Previewer view mode.

44

FIGURE 4.12The Tool Palette.

45

•Select This is the default tool. Use it to select the various objects on the report. You can then move, resize, and delete the object.

•Magnify Similar to the Zoom In and Zoom Out buttons on the toolbar, except that you can specify the center of the zoom area. To zoom out, hold the Shift key and click on the canvas.

•Rectangle Creates a rectangle or square on your report. You can use the rectangle to group database fields and provide a more aesthetically pleasing look. Holding down the Shift key creates a square.

46

•Line Puts a line on your report.•Ellipse Puts ellipses and circles on your

report. Holding down the Shift key makes circles.

•Arc Used to draw arcs on your report.•Rounded Rectangle Draws a rounded

rectangle on your form. Holding down the Shift key creates a square.

•Text Used to put static text on your report.•Field Used to put a field on your report. Unlike

static text, this information can be dynamic.•Link File Used to create a boilerplate object

(static text) on your form using text from a file.

47

•Color Box Shows the different colors chosen for drawn objects. The outer box represents the outline of the object, the inner box represents the fill values, and the T represents the color of the text.

•Fill Color Selection Brings up the color palette and allows you to specify the fill color.

•Line Color Selection Brings up the color palette and allows you to specify the outline color.

•Text Color Selection Brings up the color palette and allows you to specify the text color.

48

FIGURE 4.13The report with lines above the department totals.

49

Using the Object Navigator

•Oracle Report Builder includes the Object Navigator tool that is also found in Form Builder.

•The Object Navigator allows you to see what objects are currently being worked on and their relationships to other objects on the report.

•Figure 4.14 shows the Object Navigator for the report you have been working with.

50

FIGURE 4.14The Object Navigator found in Report Builder.

51

•You can see that there are a lot of objects created so far.

•However, none of them have descriptive names.

• There are a bunch of initials prefixing the column headings and data objects.

•Although this should not be a problem for simple reports, the names might be difficult to work with when creating longer and more complex reports.

•Name changes can be performed by clicking on the object name, waiting, and clicking again.

52

•If you are not up to the task of changing all the report’s object names, there are other tools in the Object Navigator to help you.

•The Find box can be used to help locate an object if you know the object’s name.

•The Find tool looks for and displays the objects as you type.

•This is very helpful for locating various pieces of your report.

•Additional, the hierarchy box to the left can be used to see the genealogy of the object.

53

Integrating Graphics into Reports•You can add a pie chart showing the

breakdown of the various department salaries.

•This is done with the help of the Chart Wizard.

• (you can always go back into the graph Wizard and change it).

•You can choose the location for your chart: ▫At the beginning of the report ▫At the end of the report.

54

FIGURE 4.15The Chart Wizard allows you to specify the chart type.

55

•you can enter the text for your graph titles with specifying the font colour, style, type, size and alignment.▫Title ▫Subtitle▫footnote

•Then you can choose the location, background colour and borders for the legend on your paragraph.•Also, you can select options for the plot

area of your paragraph:▫Background colour.▫Border colour.

56

FIGURE 4.16The chart showing the percentage of salaries for each department.