by | Apr 21, 2024

    How to Display Attachments in Your BIRT Reports

    In the fast-evolving world of asset management, the need for clear and comprehensive reporting is paramount. When it comes to IBM Maximo, an effective way to enhance service reports is by integrating attached images directly into the Business Intelligence and Reporting Tool (BIRT) reports. This capability not only enriches the data visualisation but also simplifies the review process for business users. In this blog, we'll explore a step-by-step guide on how to configure BIRT reports to display specific images attached by technicians via mobile applications during their operations.

     

    BPD Utility Inspection

     

    The Challenge:

    When designing BIRT reports for Maximo, a common requirement we encounter is the need to display photos attached during inspections or other fieldwork. These images provide crucial visual context for the reports, especially beneficial for business users who receive service reports but might not access Maximo directly. While Maximo's out-of-the-box (OOB) functionality offers a "Print with attachments" feature, it lacks the flexibility to show only selected images, which is often necessary.

     

    The Solution:

    To address this, we have developed a method to selectively print images using the dynamic image functionality within BIRT. This approach allows for greater control over which attachments are displayed in the report, based on specific criteria such as the question within an inspection form.

     

    Detailed Process to Achieve This Functionality:

    1. Create a DataSet:
      • Begin by creating a dataSet that fetches the urlName of the attachment from the docinfo object. This URL will be used to locate the image files attached to a record.



    2. Bind the DataSet to a Table:
      • Construct a table and bind it to the dataSet you created. If necessary, apply filters to select images related to specific questions or criteria.



    3. Insert and Configure the Image:
      • Place an image in the table cell and set its source to "Dynamic Image." Use an expression to define which images to display based on their urlName.



    4. Configure the onCreate Script:
      • Add the following code in the onCreate script to fetch and format the images:

        importPackage(Packages.java.io);

        importPackage(Packages.java.lang);

        importPackage(Packages.javax.imageio);

        importPackage(Packages.java.net);

        importPackage(Packages.java.awt.image);

        if (row["urlName"]!=null){

              var myfile = File(row["urlName"]);

              var img = ImageIO.read(myfile);

              if (img!=null){

                    bas = new ByteArrayOutputStream();

                    ImageIO.write(img, "png", bas);

                    this.data = bas.toByteArray();

                    var picWidth = img.getWidth();

                    if (picWidth > 800) {

                  this.width = '800px';

                    } else {

                  this.width = null;

                    }

              }

        }

      • This script ensures that images are correctly loaded and resized for the report.

    5. Preview and Implement:
      • After setting up the report, preview it to ensure that the images are displayed as expected. Once verified, the report can be integrated into Maximo and generated in PDF format upon completion of work orders.

    Conclusion

    Utilising dynamic image functionality in BIRT reports within Maximo offers a significant enhancement for visualising attached images in service reports. By following the steps outlined above, users can effectively filter and display specific attachments, making the information presented in reports more accessible and useful. This capability not only improves the clarity of reports but also aids in quicker decision-making by providing visual evidence directly within the report.

    If you have further questions or would like to speak to a professional about customising your Maximo reports, please reach out to us at BPD Zenith. We are here to help you optimize your asset management solutions and ensure you get the most out of your reporting tools.

     

     

     

    Sign up to our free newsletter to explore emerging technologies, industry events and Maximo best practice.