2. Handling Multiple Presentations

Exercise Objectives

The objective of this exercise is to learn the basic concepts and tools for adding more analytical capabilities to the simple application.

Exercise Description

Creating multiple presentations on one report facilitates the comparison of key business indicators. BI Beans provides APIs for manipulating the data source of presentations so that you can link a crosstab to a graph to provide detailed information. These linked presentations give users a quick glimpse of how sales change with time across different regions on a graph while showing the exact figures in a crosstab.

Exercise Tasks

Add a crosstab

To open the Presentation tag wizard

Display a crosstab below the graph in the simple application.

  1. In the Code Editor, place the cursor above the line that contains the <%-- The InsertHiddenFields tag adds state fields to the parent form tag --%> comment.
  2. In the Component Palette pane, under Business Intelligence Tags, select the Presentation icon to add the tag.
To use the Presentation tag wizard

In the Presentation wizard, you can define the attribute values for the Presentation (Crosstab) tag.

  1. In the id box, enter simpleCrosstab.
  2. Click in the location box.
  3. To browse for existing presentations, choose the button that appears to the right of the location box.
  4. Select Sales Analysis Crosstab, which is the crosstab that you created in the previous tutorial, and choose OK.
  5. Do not enter values in the remaining attributes.
  6. Choose Finish to create the tag.
To review the generated Presentation tag code

The Code Editor shows the code that is generated by the Presentation wizard. The following code identifies the crosstab definition file to use for the JSP.

<orabi:Presentation id="simpleCrosstab" location="Sales Analysis Crosstab" />

The following code displays the crosstab after the graph:

....................
<orabi:Render targetId="simpleCrosstab" parentForm="BIForm" />
....................

From the File menu, choose Save All to save the JSP application.


Run the application

You now have two presentations in the same BI application. It is time to run the application.

To display the two presentations
  1. In the System-Navigator pane, right-click simpleJSP.jsp and choose Run then simpleJSP.jsp.
    A new browser window opens and displays the simple application with a graph and a crosstab.
  2. Change dimension values for each of the presentations, and you will notice that these presentations have independent data sources. However, users generally want to see presentations with the same data source, where one presentation shows the summary and the other presentation shows the details. This can be accomplished by linking the presentations to a single data source.
  3. Return to JDeveloper.
  4. From the Run menu, choose Terminate then Embedded OC4J Server to stop the application.

Link the crosstab to the graph

To link the crosstab to the graph
  1. Copy and paste the following line of code above the line that contains the </orabi:BIThinSession> tag:

    <% simpleCrosstab.getModel().setDataSource(simpleGraph.getModel().getDataSource()); %>

    This line of code specifies that the same data source will be used for the crosstab and the graph.

  2. From the File menu, choose Save All to save the JSP application.

Run the application again

Because you have linked the two presentations, you should see different results when the application runs.

To show the linked presentations
  1. In the System-Navigator pane, right-click simpleJSP.jsp and choose Run, then simpleJSP.jsp.
    A new browser window opens and displays the simple JSP application with a graph and a crosstab. Now, the contents of the crosstab are similar to the contents of the graph.
  2. Change the year of the graph to 2001 and the contents of the crosstab change accordingly. Drill down China on the crosstab and the contents of the graph change accordingly.
  3. Return to JDeveloper.
  4. From the Run menu, choose Terminate, then Embedded OC4J Server to stop the application.

Allow presentations to handle more than 25 dimension members in page control boxes (Optional)

The Find Members dialog allows users to select specific members of a dimension when they choose More... from the page control box of a thin presentation where there are more than 25 members. If you do not provide this dialog for a presentation, then only a maximum of 25 members is displayed in the page control box and users cannot select additional members.

To create a Find Member dialog

  1. Based on the directions in the Creating a Simple BI JSP Application exercise, create a new empty page for your JSP application. Use findMemberJSP.jsp as the filename.
  2. Add a BIThinSession JSP tag with id simpleApp and the same connection configuration file /Project1BIConfig1.xml.
  3. Add a FindMember JSP tag with id findMember.
  4. From the File menu, choose Save All to save the JSP application.

To reference the Find Member dialog

  1. Open simpleJSP.jsp in the code editor. Add the following attributes to the presentations tag:
  2. findMemberPage="findMemberJSP.jsp" findMemberId="findMember"

    such that the presentation declaration tags are similar to these:

    <orabi:Presentation id="simpleGraph" location="Sales Analysis Graph" findMemberPage="findMemberJSP.jsp" findMemberId="findMember" />

    <orabi:Presentation id="simpleCrosstab" location="Sales Analysis Crosstab" findMemberPage="findMemberJSP.jsp" findMemberId="findMember" />

  3. From the File menu, choose Save All to save the JSP application.

Now, if the dimension members exceed 25, the page control box will have a More... option at the bottom of the list for the user to launch the Find Member dialog to select the appropriate member.

Exercise Summary

You added more analytic capability to the simple application by displaying multiple independent presentations on a single JSP. You also demonstrated how easy it is to link presentations so that they share the same data source, and to allow presentations to handle long list of dimension members in their page control boxes.

Best of all, you accomplished these tasks with minimal coding.

The next two exercises will add custom properties to the presentations.

1. Creating a Simple BI JSP Application | Overview | 3. Customizing Graph Properties