+ All Categories
Home > Documents > Oracle Developer 2000

Oracle Developer 2000

Date post: 06-Apr-2018
Category:
Upload: gurpreet-singh-munjal
View: 244 times
Download: 4 times
Share this document with a friend

of 85

Transcript
  • 8/2/2019 Oracle Developer 2000

    1/85

    Lesson 8

    In this lesson you will learn:

    What is Developer/2000 Tools provided by Developer/2000 to create Forms and Reports How to log on to Developer/2000 Create your first block and form based on your Student table

    What Is Developer/2000?

    Developer/2000 is an Oracle tool that helps you to create forms and reports based on the tables

    that you have created using Designer/2000. You can use Developer/2000 to:

    Design and customize your forms and reports. Add various functionality, like radio buttons, combo boxes, and list of values to make

    your forms and reports more user friendly. Write triggers on your objects to add functionality to them and capture errors.

    Tools Provided By Oracle Developer/2000

    Oracle Developer/2000 provides four tools:

    Object Navigator: In this tool you can view all your objects, add new objects andname/rename your objects.

    Layout Editor: This tool helps you design your forms and reports and add various objectsto them like push buttons and list boxes.

    PL/SQL Editor: This is the tool that is used to write all the codes for the triggers,procedures or functions. Menu Editor: This tool will help you create a customized menu that can be attached to

    your form or report.

    Logging On to Developer/2000

    1. To log on to Developer/2000, go to Start Developer R2.1 and select Form Builder(See Figure 8.1)

  • 8/2/2019 Oracle Developer 2000

    2/85

    Figure 8.1: The Start Menu for Logging in to Developer/2000

    2. Immediately, you will see the window for Developer/2000 Form Builder for Windows95/NT with the sub-window for Welcome to Form Builder. (See Figure 8.2)

  • 8/2/2019 Oracle Developer 2000

    3/85

    Figure 8.2: The Form Builder window

    3. Select 'Use the Datablock Wizard' and click OK--This is the easiest method to design anew form.

    4. You will now see the Welcome to the Datablock Wizard Window. Click Next to proceed.(See Figure 8.3)

  • 8/2/2019 Oracle Developer 2000

    4/85

    Figure 8.3: Welcome to Datablock Wizard Window

    5. You will now see the window for the Datablock Wizard. Select Table or View as in thefigure and click Next. (See Figure 8.4)

    Figure 8.4: The Datablock Wizard Window

  • 8/2/2019 Oracle Developer 2000

    5/85

    6. You will now see the window that prompts you to select a table or a view--your form willbe created based on this selection. Since no table or view is being shown, click on browseto look at the list of tables and views in your database. (See Figure 8.5)

    Figure 8.5: The window for selecting the base table

    7. Once you click browse, the connect window will appear. Type in your username,password and database to connect to the database. (See Figure 8.6)

  • 8/2/2019 Oracle Developer 2000

    6/85

    Figure 8.6: The Connect String Window

    Lesson 8, page 2

    8. You will now see the tables window. Select current users and tables and click OK. (SeeFigure 8.7)

  • 8/2/2019 Oracle Developer 2000

    7/85

    Figure 8.7: The Tables Window

    9. You will now see the list of tables created in your database. Select Students and clickOK. (See Figure 8.8)

    Figure 8.8: The window with the list of tables in the database

    10.You will now see your selected table and its available columns on your screen. Click onthe single right arrow to select the first column to be shown in your form; in this case the

  • 8/2/2019 Oracle Developer 2000

    8/85

    STUDID column. You will now see this column under the database items selected sub-

    window. (See Figure 8.9)

    Figure 8.9: The window with the selected table and its available columns.

    11.To move the rest of the columns, simply click on the double right arrow and this willselect all your columns in to the database items. (See Figure 8.10)

  • 8/2/2019 Oracle Developer 2000

    9/85

    Figure 8.10: The Database Wizard Window with all the selected columns of the base

    table

    12.You will now see the Congratulations window. Make sure that "Create the data block,then call the Layout Wizard" is selected and click on Finish. (See Figure 8.11)

  • 8/2/2019 Oracle Developer 2000

    10/85

    Figure 8.11: The Data Block Wizard Congratulations Window

    13.You will now see the Layout Wizard, prompting you to select the items that you wouldlike to show in the form. Make sure that the data block selected is Students and then clickthe double right arrow to move all the columns of the Student block from the available

    items to the displayed items. Click on Next to continue. (See Figure 8.12)

  • 8/2/2019 Oracle Developer 2000

    11/85

    Figure 8.12: The Layout Wizard Window

    14.The window with the prompt for the height and width of the items will appear. ClickNext to accept the default values. (See Figure 8.13)

    Figure 8.13: The window displaying the height and width of the items selected

  • 8/2/2019 Oracle Developer 2000

    12/85

    15.The Layout Wizard will now prompt you to select the layout or view style of your block.Select Form and click Next. (See Figure 8.14)

    Figure 8.14: The window for selecting the layout style of the selected table

    16.The Layout Wizard will now prompt you to select a title for the form that you arecreating. Type in Student Records. Click Next to continue. (See Figure 8.15)

  • 8/2/2019 Oracle Developer 2000

    13/85

    Figure 8.15: The Window for selecting the appropriate title for the Form

    17.Congratulations! You have now successfully created your first form. Click Finish to viewyour form. (See Figure 8.16)

    Figure 8.16: The Layout Wizard Congratulations Window

  • 8/2/2019 Oracle Developer 2000

    14/85

    18.You will now see the canvas view of the form that you have created. You can now addvarious objects like push buttons, combo boxes and radio buttons to your form to make itmore graphical and user friendly. We will do this in the next lesson. (See Figure 8.17)

    Figure 8.17: The canvas view of the newly created form

    19.You can now format the form manually. Click on the frame to select it. Then drag theframe to make it bigger. (See Figure 8.18)

  • 8/2/2019 Oracle Developer 2000

    15/85

    Figure 8.18: Formatting the size of the frame

    20.You can now space out the data fields to make your form more visually appealing. Youcan do this by simply selecting the data field and dragging it to your desired area. (See

    Figure 8.19)

  • 8/2/2019 Oracle Developer 2000

    16/85

    Figure 8.19: Spacing out the data fields

    21.After you have formatted all the data fields, your form should look like Figure 8.20.

  • 8/2/2019 Oracle Developer 2000

    17/85

    Figure 8.20: The formatted form

    Lesson Summary

    In this lesson you have learned:

    What is Developer/2000 Tools provided by Developer/2000 to create Forms and Reports How to log on to Developer/2000 To create a data block To create a basic form based on a table that you had created in lesson 7 How to view your form in the canvas.

    CHAPTER 9

    this lesson you will learn how to create an end-user interface and add more functionality to thebasic form that we created in Lesson 8. Specifically, this will involve:

    Creating LOVs, or List of Values, where you will connect your form to another tablefrom which the users make their selections

  • 8/2/2019 Oracle Developer 2000

    18/85

    Creating Radio Buttons Creating Combo Boxes and Poplists Creating Push Buttons Adding triggers to the Push Buttons for inserting, deleting and retrieving records

    List of Values (LOVs)

    1. In this form we are designing, we will create a List of Values for major, so that the usercan select a major from the list. To do this, first we will have to create table called

    Major_List.

    2. To do this, go to SQL*Plus and type the following code at the SQL promptSQL> CREATE TABLE MAJOR_LIST

    2 (MAJOR VARCHAR2(20));

    3. Now type in the following statement to insert more data into the Major_list table:SQL> INSERT INTO MAJOR_LIST VALUES ('Accounting');

    SQL> INSERT INTO MAJOR_LIST VALUES ('Info. Systems');SQL> INSERT INTO MAJOR_LIST VALUES ('Marketing');

    SQL> INSERT INTO MAJOR_LIST VALUES ('Finance');

    SQL> INSERT INTO MAJOR_LIST VALUES ('Decision Sciences');

    4. Now, type in Select * from Major_List to view your newly created table and its records.(See Figure 9.1)

  • 8/2/2019 Oracle Developer 2000

    19/85

    Figure 9.1: Creating table Major_List in SQL*PLUS

    5. First, select LOV in the Object Navigator on Developer/2000 and click on the "+" sign onthe toolbar to your left. (See Figure 9.2)

  • 8/2/2019 Oracle Developer 2000

    20/85

    Figure 9.2: Creating a new LOV

    6. Immediately, the window for the new LOV will pop up. (See Figure 9.3)

    Figure 9.3: The New LOV Window

  • 8/2/2019 Oracle Developer 2000

    21/85

    7. Type in the following Select statement in the window to connect the new LOV to theMajor_List table that we created earlier and click OK. (See figure 9.4)

    Figure 9.4: The New LOV Window with the select code

    select major into :studblock.major from major_list order by major;

    8. Once you click OK, you will come back to the Object navigator window. Now, name theLOV as MAJOR_LOV by double clicking the word LOV. (See Figure 9.5)

  • 8/2/2019 Oracle Developer 2000

    22/85

    Figure 9.5: Changing the name of the LOV

    9. Now go back to the Canvas View by clicking on the small picture icon just beneath theword Canvases in the Object Navigator. (See Figure 9.6)

  • 8/2/2019 Oracle Developer 2000

    23/85

    Figure 9.6: Returning to the Canvas view

    10.In the Canvas View, we will create a push button and position it right beside the Majordata field. To create the push button, select the box like icon from the toolbox, click on it

    once and drop it beside the Major data field. (See Figure 9.7)

  • 8/2/2019 Oracle Developer 2000

    24/85

    Figure 9.7: Creating a push button to place it beside the Major data field

    11.After the push button has been created, then right click on the button and select PropertyPalette from the list that pops up. (See Figure 9.8)

  • 8/2/2019 Oracle Developer 2000

    25/85

    Figure 9.8: Selecting Property Palette for the Push Button

    12.Once you are in the Property Palette, remove the label, specify Iconic as Yes and in theicon Filename type Down. Click on the close button in the lower taskbar located on the

    upper right corner. (See Figure 9.9)

  • 8/2/2019 Oracle Developer 2000

    26/85

    Figure 9.9: The Property Palette for the Push Button

    13.You will now return to Canvas View. Your Canvas will now look like Figure 9.10.

  • 8/2/2019 Oracle Developer 2000

    27/85

    Figure 9.10: The Canvas View with the Push Button for the LOV

    14.Now back in the canvas, right click on push and this time select the PL/SQL Editor. (SeeFigure 9.11)

  • 8/2/2019 Oracle Developer 2000

    28/85

    Figure 9.11: Selecting the PL/SQL Editor of the Iconic Button

    Lesson 9, page 2

    15.In the PL/SQL Editor we will write a trigger that will connect this button to the tablecalled Major_List, so that when the user clicks on the button they will be able to view the

    list of options. When you select the Pl/SQL Editor, the window for the new triggerselection will appear. (See Figure 9.12)

  • 8/2/2019 Oracle Developer 2000

    29/85

    Figure 9.12: The Window with the list of triggers available to the user

    16.We will write a When-Button-Pressed trigger, since we would like the code to beactivated when the user presses the button. Scroll down and select When-Button-pressedtrigger. (See Figure 9.13)

    Figure 9.13: Selecting the When-Button-Pressed trigger

    17.Immediately, you will see the PL/SQL Editor window. (See Figure 9.14). Type in thefollowing code in the blank space in the Editor.

  • 8/2/2019 Oracle Developer 2000

    30/85

    Declare

    Return_LOV Boolean;

    Begin

    Return_LOV :=show_LOV('Major_LOV');End;

    18.Figure 9.14: The PL/SQL Editor window

    19.After typing in the code, click compile on the upper left-hand corner of the window. (SeeFigure 9.15)

  • 8/2/2019 Oracle Developer 2000

    31/85

    Figure 9.15: The Window for the PL/SQL Editor with the code for the LOV

    20.To test how the button works, you can view the form by returning to the Canvas Viewand selecting Run Form from the Program menu. (See Figure 9.16)

  • 8/2/2019 Oracle Developer 2000

    32/85

    Figure 9.16: Selecting Run Form from the Program menu

    21.When the form is running, type in an ID number in the STUDID field (there has to bedata in the primary field). Then click the button with the down arrow. The list of majors

    will pop up. (See Figure 9.17). To return to the canvas View, simply click OK in the list

    of majors and click the close button in the upper right taskbar.

  • 8/2/2019 Oracle Developer 2000

    33/85

    Figure 9.17: The List of values for the Majors

    Lesson 9, page 3

    21.We will now create radio buttons for the FTPT_Status to give the user an option ofcreating either Full-Time or Part-Time.

    22.To do this, right click on the FTPT_Status field in the canvas view and go to its Propertypalette. (See Figure 9.18)

  • 8/2/2019 Oracle Developer 2000

    34/85

  • 8/2/2019 Oracle Developer 2000

    35/85

    Figure 9.19: The Property Palette for FTPT_Status

    24.Once you return back to the canvas, you will realize that the data field for theFTPT_Status is no longer visible. This is because we have specified it to be a radio groupand not a text item. To see them, we will have to insert radio buttons. Select radio button

    from the tool palette on your left. (See Figure 9.20)

  • 8/2/2019 Oracle Developer 2000

    36/85

  • 8/2/2019 Oracle Developer 2000

    37/85

    Figure 9.21: The Window for Attaching the radio button to a radio group

    26.Now right click on the radio button and go to its Property Palette. Change the label of thebutton to 'Full_Time', change background color to gray and give the radio button a value

    of FT. (See Figure 9.22)

  • 8/2/2019 Oracle Developer 2000

    38/85

    Figure 9.22: The Property Palette for the radio button

    27.In the same manner create a second radio button, attach it to the radio groupFTPT_Status, give it a label of 'Part-Time' and a value of PT.

    28.Select a rectangle from the palette and draw it around the radio buttons. (See Figure 9.23)

  • 8/2/2019 Oracle Developer 2000

    39/85

    Figure 9.23: The Rectangle Icon in the palette

    29.Go to the properties for the rectangle frame by right clicking on it, and change the fillpattern to none. (See Figure 9.24)

  • 8/2/2019 Oracle Developer 2000

    40/85

    Figure 9.24: Selecting the Property Palette for the rectangle frame

    30.Now, click on the rectangle frame and select Format Bevel Lowered to format theframe. (See Figure 9.25)

  • 8/2/2019 Oracle Developer 2000

    41/85

    Figure 9.25: Formatting the Rectangle Frame around the radio buttons

    31.You can now test your form by selecting Program Run Form. Your form with thenewly created radio buttons should now look like Figure 9.26.

  • 8/2/2019 Oracle Developer 2000

    42/85

  • 8/2/2019 Oracle Developer 2000

    43/85

    Figure 9.27: The Property Palette for List Item

    33.Click on the List Elements tab and type in the list elements and list values. In this lesson,the list elements and values will be same and will be Fall, Spring, Summer 1 and Summer

    2. (However, in the values, Summer1 and Summer2 should be typed in without spaces).

    (See Figure 9.28)

  • 8/2/2019 Oracle Developer 2000

    44/85

    Figure 9.28: The Window for the List Elements

    34.Now go to Programs Run Form to view your newly created Poplist. (See Figure 9.29)

  • 8/2/2019 Oracle Developer 2000

    45/85

    Figure 9.29: Window with the Poplist on Start_Sem

    35.We will now create three push buttons and write triggers for each button. To create apush button, select the button icon from the palette on the left of the canvas and drop inthe lower part of the form. (See Figure 9.30)

  • 8/2/2019 Oracle Developer 2000

    46/85

    Figure 9.30: Selecting a push button

    36.We will change the label of the first push button in the property palette to "Retrieve." Todo this, right click on the button and go to its Property Palette. (See Figure 9.31).

  • 8/2/2019 Oracle Developer 2000

    47/85

    Figure 9.31: Selecting the Property Palette for the push button

    37.Now select the PL/SQL editor by right clicking on the push button. (See Figure 9.32).

  • 8/2/2019 Oracle Developer 2000

    48/85

    Figure 9.32: Selecting the PL/SQL Editor for the push button

    38.Select the WHEN-BUTTON-PRESSED-TRIGGER, insert the following PL/SQL code inthe blank space of the editor and then click Compile.

    beginselect studid, studname, ftpt_status, sex, start_sem, start_year, major

    into :studblock.studid, :studblock.studname, :studblock.ftpt_status,

    :studblock.sex, :studblock.start_sem, :studblock.start_year, :studblock.majorfrom student

    where studid = :studblock.studid;

    exception

    when no_data_found thenmessage ('Invalid Student Id:Please enter a valid Id.');

    raise form_trigger_failure;

    end;

    39.In the above code, we are writing a select statement for retrieving the record of a studentwith any particular student ID. If no data is found on a particular student ID, then

    Developer/2000 will give an error message and raise the form_trigger_failure trigger.

    Run the form and type in a invalid STUDID to check the message. (See Figure 9.33)

  • 8/2/2019 Oracle Developer 2000

    49/85

    Figure 9.33: Error Message when invalid Student ID is entered by the user

    In a similar manner, create two other buttons, totaling three push buttons.

    40.Go to the second push button, right click on it and go to its property palette. Change itslabel to Insert. Now come back to the Layout Editor, right click again on the push buttonand go to its PL/SQL Editor. In it, write the following code in the When-Button-Pressed

    trigger:

    Commit;

    Clear_Form;

    41.Label the third push button as Clear. At the When-Button-Pressed Trigger, write thefollowing code:

    Clear_Form;

  • 8/2/2019 Oracle Developer 2000

    50/85

    42.Now go back to the Canvas View and Program Run Form to view your form with thethree push buttons. (See Figure 9.34)

    Figure 9.34: The Form with the three Push buttons

    Lesson Summary

    In this lesson, you have learned how to add various objects to your form and write triggers on

    them to add functionality. Specifically this involved:

    Creating LOVs, or List of Values, where you connected to another table from whichusers make their selections

    Creating Radio Buttons

    Creating Poplists Creating Push Buttons Adding triggers to the push buttons for inserting, clearing and retrieving records

  • 8/2/2019 Oracle Developer 2000

    51/85

    CHAPTER 10

    Lesson 10

    In this lesson, you will learn how to:

    Create Alerts (a modal window) on a push button that will function as a warning or amessage to the users when they click the button.

    Create Procedures which are stored blocks of code which can be called from multipleobjects saving the time taken for retyping codes

    Creating an Alert

    1. Go to Alerts in the Object Navigator and double click on it. (See Figure 10.1)

    Figure 10.1: Creating a New Alert

    2. Double click on the newly created alert and name it DELETE_ALERT. (See Figure 10.2)

  • 8/2/2019 Oracle Developer 2000

    52/85

    Figure 10.2: Changing the name of the new Alert

    3. Now double click on the alert and you will immediately go to its Property Palette. In theproperties:

    Change the title of the alert to Delete Alert Type in the message as "Are you sure you want to Delete?" Select Stop as the Alert style You can add a third button to the alert or just keep the OK and Cancel Make sure that Button1 is selected as the default button

    (See Figure 10.3)

  • 8/2/2019 Oracle Developer 2000

    53/85

    Figure 10.3: The Property Palette for the Alert

    4. To activate the alert, we will create a procedure which we will call from the delete button.To add a procedure, go to the Object Navigator and double click on Program Units.

    Immediately the window for the new Program unit will appear. (See Figure 10.4)

  • 8/2/2019 Oracle Developer 2000

    54/85

    Figure 10.4: Creating a new Program Unit

    5. In the window for the new Program Unit, type in the name as Display_Delete-Alert.Make sure that procedure is selected as the type of Program Unit and click OK. (See

    Figure 10.5)

    Figure 10.5: Naming the new Program Unit

    6. Once you click OK, you will be automatically taken to the PL/SQL Editor window. (SeeFigure 10.6)

  • 8/2/2019 Oracle Developer 2000

    55/85

    Figure 10.6: The PL/SQL Editor window for the new Program Unit

    7. In the PL/SQL Editor, type in the following code for activating the alert. You may haveto delete a couple of lines from the Editor to avoid duplication. In this code, we will

    declare a number variable called return_alert. We will then set it to show the alert that wecreated earlier in this lesson called Delete_Alert. We will then write a simple if/then

    statement, such that if the user clicks on OK, which is alert button 1, then

    Developer/2000 will perform the deletion and commit the changes. Otherwise, it will exitthe alert window and help the users decide on their action. (See Figure 10.7 to get a view

    of the code as it should look in the PL/SQL editor. Do not forget to compile.)

    PROCEDURE Display_Delete_Alert IS

    return_alert NUMBER;BEGIN

    return_alert := show_alert ('DELETE_ALERT');

    if return_alert = alert_button1 thencommit;else

    rollback;

    end if;

    END;

  • 8/2/2019 Oracle Developer 2000

    56/85

    8.Figure 10.7: The code for activating the alert

    9. We will now add a push button to the form and then add the above procedure to it, so thatwhenever the user clicks on delete, the alert will be shown. To do this, go the Layout

    Editor and add a push button to the form, go its properties, andchange the label to Delete

    (use the steps used to create a push button in Lesson 9). Now go to its PL/SQL Editor byright clicking on the push button. (See Figure 10.8)

  • 8/2/2019 Oracle Developer 2000

    57/85

    Figure 10.8: Selecting the PL/SQL Editor for the Delete button

    10.At the When-Button-Pressed trigger in the PL/SQL Editor, write the following code:delete from student where studid = :studblock.studid;delete_record;

    Display_Delete_Alert;

    11.The last line of the code will call the previously created procedure Display_Delete_Alertand activate the alert whenever the user clicks on the delete button. The first two lines of

    code delete the record for any particular student ID. (See Figure 10.9 to get a view of the

    alert when the user clicks the delete button).

  • 8/2/2019 Oracle Developer 2000

    58/85

    12.

    Figure 10.9: The fully functional form with the alert on the Delete button

    Lesson Summary

    In this lesson you have learned how to:

    Create alerts on push buttons (delete) so that when the user clicks on the button the alertis shown as a warning

    Create procedures or stored blocks of code that can be called from any objectCHAPTER 11

    In this lesson you will learn how to create reports based on our existing Student table.Specifically, this will involve:

    Using the Data Model Wizard Using the Layout Editor to customize our reports Creating charts

  • 8/2/2019 Oracle Developer 2000

    59/85

    Our objective will be to create a simple report that will list students along with some student

    attributes. Students in this report will be categorized by major. As a starting point, let us assumethat the STUDENT table has the following rows. (See Figure 11.1).

    Figure 11.1: The Student table as viewed in SQL *Plus

    You may enter the data shown below using the INSERT statement in SQL*Plus covered earlierin the tutorial (see Lesson 9). For example, the following statement may be used to insert the first

    row (for the student Diana with Student Id '1113').

    SQL> insert into student values ('1113', 'Diana', 'PT', 'F', 'Fall', 1996, 'Marketing', 'Y');

    Enter the rest of the data as shown in Figure 11.1.

    Creating Reports:

    1. In order to create reports, you will need to go to the Reports Builder in OracleDeveloper/2000. To do this, go to the Start button and select Programs Developer 2000R2.1 Report Builder (See Figure 11.2)

  • 8/2/2019 Oracle Developer 2000

    60/85

    Figure 11.2: Logging on to Report Builder

    2. Immediately, you will see the Welcome to Report Builder Window. Select the radiobutton for theBuild a new report manually and click OK. ( See Figure 11.3)

  • 8/2/2019 Oracle Developer 2000

    61/85

    Figure 11.3: The Welcome to Report Builder window

    3. Once you click OK, you will see the Report Editor-Data Model window, with a defaultname for the Data Model. (See Figure 11.4)

    Figure 11.4: Window for the Report Editor- Data Model

  • 8/2/2019 Oracle Developer 2000

    62/85

    4. The Report Editor is the tool that you will use to create your data model for the report.Click on the SQL icon (See Fig. 11.5) in the toolbar located on the left hand side, anddrag and drop it on the palette. Immediately, the SQL Query Statement window will

    appear. Type in the displayed SQL query to view student information in order of major.

    (See Figure 11.6)

    Figure 11.5: The SQL icon in the toolbar of the Report Editor

    Figure 11.6: The SQL Query Statement window

    5. Once you click OK, Developer/2000 will prompt you to connect to the database. Type inyour User Name, Password and Database. (See Figure 11.7).

    Figure 11.7: The Connect window for connecting to the Database

  • 8/2/2019 Oracle Developer 2000

    63/85

    6. You will now see your data model, where Q_1 stands for the name of the query andG_Major, stands for its associated record group which contains the list of fields that youwill be able to view in your report. (See Figure 11.8)

    Figure 11.8: The Report Editor with the Data Model

    7. To change the name of your query, right click on it and select the Property Palette. (SeeFigure 11.9)

  • 8/2/2019 Oracle Developer 2000

    64/85

    Figure 11.9: Selecting the Property Palette of the Query

    8. Immediately, you will see the window for the Property Palette. Change the name bytyping in the name (Q_StudMajor) beside the 'Name' tab, and press enter. You can alsochange or edit your SQL query by clicking on the space beside the SQL Query Statement

    tab. (See Figure 11.10)

  • 8/2/2019 Oracle Developer 2000

    65/85

    Figure 11.10: The Property Palette window for the Query

    9. Your Data Model should now look like the one in Figure 11.11.

  • 8/2/2019 Oracle Developer 2000

    66/85

    Fig. 11.11: The Edited Data Model

    10.Recall that we have been asked to create a report that will display a list of students andtheir related information organized by Majors. To do this, we will move the Majorrecords into a separate record group. In Oracle Developer/2000 terms, it is called to'break out'. First, click on the G_Major, and drag and lower it to create more space

    between the record group and the query. Then select Major, and drag and drop it on the

    line connecting Q_StudMajor and G_Major. (See Figure 11.12)

  • 8/2/2019 Oracle Developer 2000

    67/85

    Figure 11.12: Creating a Break Group

    11.Your Data Model should now look like the one in Figure 11.13 with a new group forMajor.

  • 8/2/2019 Oracle Developer 2000

    68/85

    Figure 11.13: The Edited Data Model with a separate record group for Major

    12.Right click on the G_Major to go to its Property Palette. Change its name to G_Break.(See Figure 11.14)

  • 8/2/2019 Oracle Developer 2000

    69/85

    Figure 11.14: The Property Palette for the Major record group

    13.Your Data Model should now look like Figure 11.15.

  • 8/2/2019 Oracle Developer 2000

    70/85

    Figure 11.15: The Updated Data Model

    14.Now select Report Wizard from the Tools Menu to generate the report. (See Figure11.16)

  • 8/2/2019 Oracle Developer 2000

    71/85

    Figure 11.16: Selecting the Report Wizard from the Tools Menu

    15.You will now see the first screen of the Report Wizard. Type in "List of Students byMajor" in the Title box. Next, select the radio button for Group Above in order to create

    breaks after record groups for each Major. Now, click Next. (See Figure 11.17)

  • 8/2/2019 Oracle Developer 2000

    72/85

    Figure 11.17: Selecting a report style using the Report Wizard

    16.You will now see your SQL statement again. You can edit your statement here if youchoose to. At this time we will use the query that we had entered earlier. Click Next. (SeeFigure 11.18)

  • 8/2/2019 Oracle Developer 2000

    73/85

    Figure 11.18: Editing the SQL Statement

    17.You will now be prompted to select the fields that you would like to designate as groupfields. You will find that Oracle has already selected Major. (See Figure 11.19). Now,

    select the next tab, Fields.

  • 8/2/2019 Oracle Developer 2000

    74/85

    Figure 11.19: Selecting a field to Designate as group Field

    18.You will now be asked to select the fields that you will display in your report. We wouldlike to see all the fields, so click on the double right facing arrows to select all the fields

    and click Next. (See Figure 11.20).

  • 8/2/2019 Oracle Developer 2000

    75/85

    Figure 11.20: Selecting the Fields that are to be displayed in the Report

    19.You will now be prompted to select fields for which you would like to calculate totals.Let us assume that we have been asked to provide the total number of students in eachmajor and also the Grand total of the number of students. To do this, select StudID, and

    click on Count. (See Figure 11.21).

  • 8/2/2019 Oracle Developer 2000

    76/85

    Figure 11.21: Selecting a Field on which you will calculate a total

    20.Your Screen should look like Figure 11.22 with Count (StudId) in the Totals column).Click Next.

  • 8/2/2019 Oracle Developer 2000

    77/85

    Figure 11.22: A view of the Totals Screen

    21.You can now modify your labels and their width. In this case we have put a colon and aspace after Major and have changed the label for CountStudIdPerReport to "Number of

    Students: " and click Next. (See Figure 11.23)

  • 8/2/2019 Oracle Developer 2000

    78/85

    Figure 11.23: Modifying the labels and their width of the report.

    22.The final modification involves selecting an appropriate template for the report. In thiscase, we will select Corporate2 from the list provided. You are free to select any templateof your choice. Click Finish. (See Figure 11.24)

  • 8/2/2019 Oracle Developer 2000

    79/85

    Figure 11.24: Selecting an appropriate template for the report

    23.Your report should now look like the one in Figure 11.25.

  • 8/2/2019 Oracle Developer 2000

    80/85

    Figure 11.25: The newly created report

    Lesson 11, page 4

    24.The following figure provides a closer look at the created report. We will now create achart that will let us compare the distribution of students in each major. For this, selectthe Chart Wizard by clicking on the icon with the tiny bar graphs as indicated by the

    arrow in Figure 11.26.

  • 8/2/2019 Oracle Developer 2000

    81/85

    Figure 11.26: Selecting the Chart Wizard

    25.You should see the Welcome to the Chart Wizardwindow. Click Next. (See Figure11.27)

    Figure 11.27: The Welcome to the Chart Wizard Window

  • 8/2/2019 Oracle Developer 2000

    82/85

    26.You will now be prompted to enter a chart title, select a chart type and a chart subtype.Type in "Distribution of Students by Majors" in the box for the title. Select Pie as thetype of chart and Depth as the Chart Subtype. (See Figure 11.28)

    Figure 11.28: Selecting a Chart type and subtype and providing a title for the Chart

    27.You will now have to select a field for the X-axis. Select Major and click on the rightarrow. (See Figure 11.29)

    Figure 11.29: Selecting a field for the X axis

  • 8/2/2019 Oracle Developer 2000

    83/85

    28.Now select CountStudIdPerMajor as the field for the Y-axis and click on the right arrow.(See Figure 11.30)

    Figure 11.30: Selecting a field for the Y axis

    29.You will now have to select a chart placement for the chart in the report. Let us assumethat we would like the chart to be placed at the end of the report. Select at the end of the

    reportand click Next. (See Figure 11.31)

    Figure 11.31: Selecting an appropriate chart placement for the chart in the report

    30.You will now see the Congratulations window. Click on Next. (See Figure 11.32)

  • 8/2/2019 Oracle Developer 2000

    84/85

    Figure 11.32: The Congratulations Window for successfully creating the chart

    31.Your chart should now look like Figure 11.33.

    Figure 11.33: The newly created chart

  • 8/2/2019 Oracle Developer 2000

    85/85

    32.See Figure 11.34 to get a view of your report with the chart at the end of it.

    Figure 11.34: The report with the chart at the end of it

    33.You can now save your report by selecting the diskette icon from the toolbar of the reportor by selecting File Save as SRSrpt. Oracle will save your report in the Bin folderunder Orawin 95 as a .rdf.

    34.You can also print your report by selecting File Print.Lesson Summary

    In this lesson you have learned how to:

    Create a simple Data Model using the Report Editor Create "Breaks" in the Data Model Generate reports based on the created Data Model using the Report Wizard Create simple charts using the Chart Wizard


Recommended