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

<rw:id>

The rw:id tag generates a unique DOM, or HTML id value for row and column headers, wherever it is referenced. It is used in the JSP code to produce accessible HTML so that a cell of a table can reference the header in the table, by using the headers attribute, which is important for screenreading software.

The output of this tag will be: id = unique_tag. Used within a rw:foreach loop, the output will only be generated at the frequency specified by breakLevel. There will be no output for repeated rows and columns. The resulting unique_tag is composed of a prefixed H plus a user-defined tag id plus a serial number. For example: <rw:id id="BDNAME"> will output HBDNAME100.

The rw:id defines a Java script variable, which is only accessible in the scope in which it is defined. In matrix reports, matrix cells and cross labels are in different rw:foreach tag bodies, or scopes. These Java script variables created by the cross labels' rw:id tag are then no longer valid when the cells are displayed. To solve this problem, the asArray attribute can be set to yes and you can use PageContext to save the id object, while using the rw:headers tag to retrieve id values. The id object contains an array of id values, and an array index pointing to the current id in the array.

Syntax

<rw:id id="user_defined_id"  breakLevel="frequency" [asArray="use_array" /> 

Attribute Value

Description

user_defined_id

A unique identifier in the page scope.

frequency

The frequency at which the column should repeat.

use_array

(Optional) Can be either of the following:

  • yes: An id object is retrieved from the page context, a unique id value is added to this id object, which is in turn put back into PageContext.

  • no: (default) An id object with one unique id value is saved in the page context

Examples

Example 1

This example shows the use of the rw:id tag. Note how the cells in the table reference the id in the headers attribute.

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

Example 2

This example shows a matrix report JSP source. Note how the rw:id tag has its asArray attribute set to yes.

<tr>
  <rw:foreach id="fe_dept1" src="G_dept">
    <rw:foreach id="fe_job1" src="G_job">
      <td <rw:id id="dept" breakLevel="fe_dept1" asArray="yes"/>>
          <rw:field src="deptno" breakLevel="fe_dept1"/>
      </td>
    </rw:foreach>
  </rw:foreach>
</tr>

<!-- header: job -->
<tr>
  <rw:foreach id="fe_dept2" src="G_dept">
    <rw:foreach id="fe_job2" src="G_job">
      <td <rw:id id="job" asArray="yes"/> <rw:headers id="dept"/>>
        <rw:field src="job"/>
      </td>
    </rw:foreach>
  </rw:foreach>
</tr>

<rw:foreach id="fe_region" src="g_region">
  <rw:foreach id="fe_office" src="g_office">
    <tr>
      <!-- header: region -->
      <td <rw:id id="region" breakLevel="fe_region">>
          <rw:field src="region" breakLevel="fe_region">
      </td>

      <!-- header: office -->
      <td <rw:id id="office">>
        <rw:field src="office">
      </td>

      <!-- cells -->
      <rw:foreach id="fe_dept3" src="G_dept">
        <rw:foreach id="fe_job3" src="G_job">
          <td <rw:headers id="cellheaders" src="region,office,dept,job"/>>
             <rw:field src="sumSal">
          </td>
        </rw:foreach>
      </rw:foreach>
    </tr>
  </rw:foreach>
</rw:foreach>

</table>

See also

Oracle Reports JSP tags

About JSP tags

About JavaServer Pages and servlets