Wednesday, November 23, 2016

Best Practices for Developing Jaspersoft Studio Reports

Use Jaspersoft Studio to build and manage your own custom reports in Advanced Reporting. As a prerequisite, set up the CA JDBC Adapter to connect to the CA PPM transactional or Data Warehouse schemas without a VPN connection.The adapter lets you run and test report queries faster and more efficiently.
The following guidelines for developing reports using Jaspersoft Studio represent the most efficient course of action. We highly recommend that you follow these best practices.

Start the Report

  • Install and use the Jaspersoft Studio version that corresponds to the CA PPM version that you have in your environment. Avoid installing more than one version of Jaspersoft Studio on the same computer.
  • Try to use existing out of the box (OOTB) reports as examples when you start developing your custom reports. The PMO Accelerator Advanced Reporting content includes more than 50 reports that you can use as a starting point.
  • Do not modify the reports under the CA PPM folder. Make a copy of the OOTB report and modify the copy.
  • Organize the folder structure for your custom content similar to the CA PPM folder organization, taking into consideration how you want to manage security. You can allow access at the folder level or at the report level.
  • Create your reports outside the CA PPM folder, not under it. Create a folder under the organization for your own reporting content or use the Shared folder when the reports are available to all users.
  • Provide an ID that identifies the report as your custom report when you create a new report. For example, start with your company name or abbreviation. 
  • When copying and modifying an OOTB report, use the same procedure that you use to create a report. Provide a new ID and use the JRXML file of the OOTB report to upload the copy. 
  • Follow the rules that are required by Jaspersoft, avoiding spaces and special characters when you create the JRXML file name that you use to upload the report. We recommend CamelCase Notation.

Design the Report

  • Limit the number of input controls that you include in your report. Only include input controls that are relevant for the report. 
  • Always try to categorize the data when you have input controls with high cardinality (values that are uncommon or unique, such as resources or investments). Use cascading input controls when possible.
  • Create resources in the repository, such as input controls and images, so that you can use them for more than one report. Take advantage of the resources that are already created and avoid redundancy. For example, input controls that are used by one report should be created outside the report unit so that you can use them in other reports that you create later.
  • Create a report template that contains headers, styles, company logos, page footer, and other definitions before starting a project. Report templates save time and effort and help reports have a consistent look and feel.  
  • Keep a backup copy of the JRXML files that you create or modify. Store these copies in a source control tool or any other system or collaboration tool that you use to control source code.

Develop the Report

  • We do not recommend that you develop reports in Jaspersoft Studio using domains as data sources. This practice can have a severe impact on performance. SQL is the preferred language for developing reports in Jaspersoft Studio.
  • Limit the number of subdatasets (subqueries) in your report. The recommended limit is 10 subdatasets. 
  • Limit the number of subreports that are called by the main report. The recommended limit is 10 subreports.
  • Use the "Print When Expression" option, when possible, to avoid unnecessary calls to subreports and subqueries.
  • Use frames to group elements, especially when you have several fields in the report layout. Avoid hiding elements using rectangles or other elements. Frames can be invisible and they keep fields aligned when exporting to Microsoft Word and to other export options.
  • Always use the "Text Field" element, even if you are defining static text. The "Text Field" element gives you more flexibility and allows for internationalization. 
  • Always define the "Pattern" property for the "Text Field" element when it returns values of type other than text and date.
  • Avoid overlapping fields (for example, making the width of an element extend over the next element). Fields that are overlapping do not display when the report is exported.
  • Create your own images or use the images included in the PMO Accelerator Advanced Reporting content. Use the "repo://" syntax to reference the image inside the report.
    Example: repo:/ca_ppm/resources/images/stoplightRed
  • When working with images, we recommend that you use one image element associated to an IF-THEN-ELSE expression to display different images instead of having several image elements.
  • Use Groovy as the language for the report. In Jaspersoft Studio, select the report name at the top of the hierarchy in the Outline view and change it on the Properties, Report tab. When you use Groovy, you can use built-in functions and simpler expressions. You can still use Java in your expressions, if necessary.
  • Use the following OOTB built-in parameters in your report queries. These parameters are passed through the integration between CA PPM and the JasperReports Server.
    • ppmUserUITheme. The UI Theme selected as default in CA PPM.
    • ppmUser. The user name of the user who is logged in to CA PPM.
    • ppmUserLanguage. The user language of the user who is logged in to CA PPM.
    • ppmDBName. The database name that is used for Microsoft SQL Server.
    • ppmDBSchema. The CA PPM database schema. 
    • ppmDBVendor. The CA PPM database vendor (oracle, mssql).
    • dwhDBSchema. The Data Warehouse database schema.
    • dwhDBVendor. The Data Warehouse database vendor.
    • dwhDBLink. The CA PPM Database Link as defined in CSA.

Publish the Report

  • You do not need to publish a report every time that you edit it. After you have the report unit created, you can upload the JRXML file from Jaspersoft Studio instead of publishing the report.
  • Avoid publishing reports with subreports from Jaspersoft Studio. When you modify reports that include subreports, download the reports to your local server and upload the updated JRXML file. Follow this procedure for the main report and subreports.
    You can also upload a local JRXML file from the Set Up the Report page when you edit the report in Advanced Reporting. However, the report server does not validate the JRXML file when you upload it.  Use Jaspersoft Studio to validate the JRXML before uploading it.  
  • Compile the report in Jaspersoft Studio to validate it before uploading. Click the Compile Report icon that is located in the upper right corner of the Design area. The following image shows the Compile Report icon.
This image shows the Compile Report icon.
  • When you are publishing a report, the Select Resources to publish window displays. Select Ignore from the drop-down instead of Overwrite for all resources included on this window that exist in the repository.