Add a new report

To add a new report:

  1. Define the report in three XML files.

    Reports require three XML files. These files must be located in the WC_installdir/xml/tools/reporting directory. This directory also contains XML files for default reports that come with WebSphere Commerce. Use these files as examples for your new report's XML files. The three required XML files are:

    • reportNameReportInputDialog.xml for display text for the input JSP file.

      For examples see Sample report input and output XML files or the default report XML files in the WC_eardir/xml/tools/reporting directory.

    • reportNameReportOutputDialog.xml for display text for the output JSP file.

      For another example see Sample report input and output XML files or the default report XML files in the WC_eardir/xml/tools/reporting directory.

    • reportNameReport.xml for the SQL used to retrieve the data for the report. Ensure the SQL statement runs successfully before continuing to create your report.

      For more information, see Sample report XML file and Valid XML elements, or the default report XML files in the WC_eardir/xml/tools/reporting directory.

  2. Update resources.xml

    Update WC_installdir/xml/tools/reporting/resources.xml with information about the three XML files created in the previous step. Add lines similar to the following:

    <resourceXML name="reportName" file="reporting/reportName.xml" />
    <resourceXML name="reportNameInputDialog" file="reporting/reportNameInputDialog.xml" />
    <resourceXML name="reportNameOutputDialog" file="reporting/reportNameOutputDialog.xml" />
    

  3. Create the JSP file from which the report is requested.

    This JSP file is used to collect data from the customer. The report is then generated based on this data. The filename for this input JSP file should follow the naming convention: reportNameReportInputView.jsp

    This code sample shows an example of an Example input JSP file for a report.

    The input JSP file may contain helper JSP files. For more information about helper JSP files, see Helper JSP files for reporting.

    Refer to Input JSP files for more information.

  4. Create the JSP file to display the report, unless the generic JSP is used.

    This JSP file is used to visualize the report to the customer. The filename for this output JSP file should follow the naming convention:reportNameReportOutputView.jsp.

    This code sample shows an example of an Example output JSP file for a report.

    The output JSP file may contain helper JSP files. For more information about helper JSP files, see Helper JSP files for reporting.

    Refer to Output JSP files for more information.

  5. Update OperationalReportsNLS.properties

    Update OperationalReportsNLS.properties with the report name, description and bread crumb trail that displays in the WebSphere Commerce Accelerator menu. This file is in the WAS_installdir/host_name/WCServer_enterprise_archive/properties/com/ibm/commerce/tools/reporting/properties directory. If national languages are enabled, you should also update OperationalReportsNLS_locale.properties, found in the same directory.

  6. Update Reports_en_US.properties.

    The default properties file, Reports.properties should also be updated. This file contains the text that displays on the input JSP page. If other national languages are supported, also update the appropriate properties files. The reporting properties files are in the WAS_installdir/host_name/WCServer_enterprise_archive/properties/com/ibm/commerce/tools/reporting/properties directory . This file is also used by the default reports that ship with WebSphere Commerce. Refer to the existing entries as an example.

  7. Add your new report to a WebSphere Commerce Accelerator menu.

    To add your report to a WebSphere Commerce Accelerator menu, edit WC_installdir/xml/tools/reporting/OperationalReportsContext.xml. The XML file contains <context> and <entry> XML tags. The <context> tags define a group of reports that display on one page in WebSphere Commerce Accelerator. The <entry> tags exist in between the <context> and </context> tags and represent each report that displays on the page. OperationalReportsContext.xml is also used for the default reports that ship with WebSphere Commerce. For a better understanding, compare the XML entries to the menu items and reports in WebSphere Commerce Accelerator to understand their relationship.

  8. You must register your newly created views in the Struts configuration files . The reportNameReportInputView and reportNameReportOutputView and reportNameReportDialogViewcommands must be added to into the configuration file. Add the entries to the struts-config-ext.xml file to point to your customized JSP pages and controller commands. All customization changes should be made in struts-config-ext.xml, not to struts-config.xml. To register the new views...

    1. In the WebSphere Commerce development environment, navigate to the CommerceAccelerator/Web Content/WEB-INF folder.

    2. From the struts-config-ext.xml file's pop-up menu, select Open.

    3. Add the following code:
      <global-forwards>
         <forward name="reportNameReportInputView" path="/tools/reporting/reportNameReportInputView.jsp" 
            className="com.ibm.commerce.struts.ECActionForward" /> 
         <forward name="reportNameReportOutputView" path="/tools/reporting/reportNameReportOutputView.jsp" 
            className="com.ibm.commerce.struts.ECActionForward" /> 
         <forward name="reportNameReportDialogView" path="/tools/common/Dialog.jsp" 
            className="com.ibm.commerce.struts.ECActionForward" /> 
      </global-forwards>
      <!-- Action Mappings --> 
      <action-mappings type="com.ibm.commerce.struts.ECActionMapping">
         <action path="/reportNameReportInputView type="com.ibm.commerce.struts.BaseAction" /> 
         <action path="/reportNameReportOutputView type="com.ibm.commerce.struts.BaseAction" />
         <action path="/reportNameReportDialogView" type="com.ibm.commerce.struts.BaseAction" /> 
      </action-mappings>
      

  9. Update ACACTION and ACACTDESC tables

    Insert the actions into the ACACTION and ACACTDESC tables. Each of these actions maps to a view that was inserted into the Struts configuration file in the previous step.

    Determine valid unused values for acaction_id. You will insert these into the database later in this step:

    1. Determine the current largest acaction_id.
      db2 select max(acaction_id) from acaction
      

    2. Determine current key table value for the acaction table.
      db2 select counter from keys where tablename='acaction'
      

    3. Valid unused values are between the current largest acaction_id and the current key table value.

    Update the ACACTION and ACACTDESC table. The values for acaction_id must be valid unused values you determined previously in this step. The values for action in steps a, b, and c, must match the three values inserted as name in the forward element in the Struts configuration file in step 8. For example with a DB2 database:

      db2 insert into acaction (acaction_id, action) values (acaction_id_1, 'reportNameReportDialogView');  db2 insert into acaction (acaction_id, action) values (acaction_id_2, 'reportNameReportInputView');
      db2 insert into acaction (acaction_id, action) values(acaction_id_3, 'reportNameReportOutputView');
      db2 insert into acactdesc (acaction_id, displayname, description, language_id)values (acaction_id_1, 
       'View to request the report for reportName','View to request the report for reportName', -1);  db2 insert into acactdesc (acaction_id, displayname, description, language_id)values (acaction_id_2, 
       'Specifies the criteria to create the report for reportName','Specifies the criteria to create the report for reportName', -1);  db2 insert into acactdesc (acaction_id, displayname, description, language_id) values (acaction_id_3, 
       'Displays the report for reportName','Displays the report for reportName', -1);  

    1. Set access control on the three views added in the previous step.

      1. Open the WebSphere Commerce Organization Administration Console.

      2. Select Access Management > Action Groups.

      3. Select the Action Groups that should have access to your new report.

      4. Select Change.

      5. From the Available Actions list, select the views inserted in step 8.

      6. Click Add.

      7. Click OK.

      Refer to Protecting Views for more information.

    2. Stop and start the WebSphere Commerce Server.

    Related concepts

    Related tasks

    Related reference