A script-enabled browser is required for this page to function properly.

<rw:report>

The rw:report tag delimits a report object within a JSP. Any other report custom tags must exist within the scope of the rw:report tag. The body of the rw:report tag is the scope of the report. Within the body, the report object can be accessed directly or through other custom tags. By itself, the rw:report tag creates an empty report and an oracle.reports.Report object. The definitions for this report can be added and modified by the rw:objects tag. Nesting of rw:report tags is not allowed.

Note: the body is required and evaluated.

Syntax

<rw:report id="report_name" [parameters ="parameters"]>
   [tag body]
</rw:report>

Attribute Value

Description

report_name

A unique identifier in the page scope.

parameters

The specified values provide parameters to the current rw:report tag. The parameters attribute uses the URL syntax to set report parameters, like this: parameters="userid=scott/tiger@nt805&server=repsvr&deptno=20".

Parameters can also be set in a URL when the report is run from the browser. For example:  http://hostname/reports/foo.jsp?server=repsvr&userid=scott/tiger@nt805&deptno=10

The parameters from the rw:report tag are merged into the URL parameters. If there are parameter conflicts, an exception is raised. You can also pass parameters using key mappings defined in cgicmd.dat. A key is expanded within the context of the tag or URL before the parameters are merged. Again, if there are parameter conflicts in the rw:report tag and the URL, an exception is raised.

Using key mappings in cgicmd.dat

When using key mappings defined in the cgicmd.dat file, the order in which the parameters are substituted into the key is determined by the placement of CMDKEY. For example, suppose you have a key such as the following in cgicmd.dat:

mykeys: DEPTNO=%1 MYPARAM=%2

Now, you execute a JSP report that references this key as follows:

  • Using parameters attribute: parameters="userid=scott/tiger@hrdb&cmdkey=mykeys&10&test"
  • Using URL: http://neptune.world.com:80/jsp/myreport.jsp?userid=scott/tiger@hrdb&cmdkey=mykeys&10&test

Because of the placement of CMDKEY, the 10 corresponds to %1 and test corresponds to %2. Even though they are not the first and second parameters in the string, 10 and test are the first and second parameters to follow CMDKEY.

Examples

Example 1

This example shows an empty report block.

<%@ taglib uri="/WEB-INF/lib/reports_tld.jar" prefix="rw" %>
   <rw:report  id="report">
     <rw:objects id="xmldefinitions"></rw:objects>
   </rw:report>

Example 2

This example shows a complete report block. Note that this example is based on the Oracle Reports Tutorial sample code. It contains most of the Oracle Reports Custom JSP tags. The rw:report open and closing tags contain the entire report.

In this example, the first line of the JSP specifies the custom tag library definition file and defines a prefix that is to be used for the custom tags. In this case, the prefix is rw, which is the default prefix. You can see that rw:reports and rw:objects, respectively, delimit and define the report block. Inside the HTML body, the custom tags rw:graph, rw:foreach, rw:field, rw:getValue, rw:seq, rw:seqVal, and rw:id are called to create a report block with values from a database table.

<%@ taglib uri="/WEB-INF/lib/reports_tld.jar" prefix="rw" %>
<rw:report id="myReport">
<rw:objects id="myObjects">
<report DTDVersion="9000010" name="myReport">
  <data>
    <dataSource name="Q_1">
      <select>
         SELECT ALL EMPLOYEES.EMPLOYEE_ID
           ,EMPLOYEES.FIRST_NAME||','|| EMPLOYEES.LAST_NAME EMP_NAME
           ,EMPLOYEES.HIRE_DATE
           ,EMPLOYEES.SALARY
           ,EMPLOYEES.COMMISSION_PCT 
           ,EMPLOYEES_A1.EMPLOYEE_ID
           ,EMPLOYEES_A1.FIRST_NAME||','|| EMPLOYEES_A1.LAST_NAME MGR_NAME
         FROM EMPLOYEES, EMPLOYEES EMPLOYEES_A1
         WHERE (EMPLOYEES.MANAGER_ID = EMPLOYEES_A1.EMPLOYEE_ID)
      </select>
      <group name="G_MGR_NAME">
        <dataItem name="MGR_NAME"/>
        <summary name="SumSALARYPerMGR_NAME" source="SALARY" function="sum"
         reset="G_MGR_NAME" compute="report">
        </summary>
        <summary name="TotalSALARYPerMGR_NAME" source="SALARY"
         function="percentOfTotal" reset="G_MGR_NAME" compute="report">
        </summary>
      </group>
      <group name="G_EMP_NAME">
        <dataItem name="EMP_NAME"/>
        <dataItem name="EMPLOYEE_ID"/>
        <dataItem name="HIRE_DATE"/>
        <dataItem name="SALARY"/>
        <dataItem name="COMMISSION_PCT"/>
        <dataItem name="EMPLOYEE_ID1"/>
        <summary name="TotalSALARYPerEMPLOYEE_ID" source="SALARY"
         function="percentOfTotal" reset="G_EMP_NAME" compute="G_MGR_NAME">
        </summary>
      </group>
    </dataSource>
    <summary name="SumSALARYPerReport" source="SALARY" function="sum"
     reset="report" compute="report">
    </summary>
  </data>
<report>
</rw:objects>

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 <meta name="GENERATOR" content="Mozilla/4.73 [en] (WinNT; U) [Netscape]">
 <title>Employee Review</title>
</head>


<p><b><font color="#336699">Employee Details</font></b></p>
<p>You are ready to compare Employee salaries. 
   The information included below will prepare you 
   for the Departmental Review meeting.</p>

<p>The following graph shows your direct reports by salary:</p> 

<rw:graph id="myGraph" src="G_EMP_NAME" series="MGR_NAME" dataValues="SALARY">
 <?xml version="1.0" ?>
 <Graph version="1.5.0.5" pagingControlVisible="true" seriesTooltipLabelType="TLT_NONE"   groupTooltipLabelType="TLT_NONE">
 <LegendArea position="LAP_RIGHT">
 <Rect height="19991" width="5535" x="10141" y="9159"/>
 </LegendArea>
 <O1Axis lineWidth="1"/>
 <O1MajorTick lineWidth="1"/>
 <O1Title text="Employee" visible="true"/>
 <PieFrame>
 <Rect height="25224" width="19790" x="-15316" y="12109"/>
 </PieFrame>
 <PlotArea>
 <Rect height="19589" width="15694" x="-10681" y="9426"/>
 </PlotArea>
 <Title text="Employees by Salary" visible="true"/>
 <X1Axis lineWidth="1"/>
 <Y1Axis lineWidth="1"/>
 <Y1MajorTick lineWidth="1"/>
 <Y1Title text="Salary" visible="true"/>
 <Y2Axis lineWidth="1"/>
 <Y2MajorTick lineWidth="1"/>
 </Graph>
</rw:graph>


<p>The following report provides salary details on your direct reports:</p>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
 <!-- Header -->
 <tr>
  <th <rw:id id="idEmpName"/>> Employee Name </th>
  <th <rw:id id="idEmpId"/>> Employee # </th>
  <th <rw:id id="idHireDate"/>> Hire Date </th>
  <th <rw:id id="idSalary"/>> Salary </th>
  <th <rw:id id="idCommision"/>> Commission  </th>
  <th <rw:id id="idManager"/>> Manager # </th>
  <th <rw:id id="idTotal"/>> % of Total: </th>
 </tr>
 <!-- Body -->
 <rw:seq name="bgcolor" seq="#bbbbbb, #ffffff"/>
 <rw:foreach id="R_G_EMP_NAME_1" src="G_EMP_NAME">
  <tr bgcolor="<rw:seqval ref="bgcolor" op="nextval"/>">
   <td headers="<%= idEmpName %>">   <rw:getValue id="myEmpName"   src="EMP_NAME"/><%= myEmpName %></td>
   <td headers="<%= idEmpId %>">     <rw:field id="F_EMPLOYEE_ID"  src="EMPLOYEE_ID">               F_EMPLOYEE_ID </rw:field></td>
   <td headers="<%= idHireDate %>">  <rw:field id="F_HIRE_DATE"    src="HIRE_DATE">                 F_HIRE_DATE   </rw:field></td>
   <td headers="<%= idSalary %>">    <rw:field id="F_SALARY"       src="SALARY">                    F_SALARY      </rw:field></td>
   <td headers="<%= idCommision %>"> <rw:field id="F_COMM_PCT"     src="COMMISSION_PCT">            F_COMM_PCT    </rw:field></td>
   <td headers="<%= idManager %>">   <rw:field id="F_EMPLOYEE_ID1" src="EMPLOYEE_ID1">              F_EMPLOYEE_ID </rw:field></td>
   <td headers="<%= idTotal %>">     <rw:field id="F_TotalSALARY"  src="TotalSALARYPerEMPLOYEE_ID"
                                                                 formatMask="%NNNNN.00">          F_TotalSALARY </rw:field></td>
  </tr>
 </rw:foreach>
 <tr>
  <th> Total: </th>
  <th>   </th>
  <th>   </th>
  <td><rw:field id="F_SumSALARYPerReport" src="SumSALARYPerReport"> F_SumSALARYPerReport </rw:field></td>
  <th>   </th>
  <th>   </th>
  <th>   </th>
 </tr>
</table>
</body>
</html>
</rw:report>

See also

Oracle Reports JSP tags

About JSP tags

About JavaServer Pages and servlets