Alternative way of generating reports in IBM Maximo using JavaScript

By default, IBM Maximo comes with several reporting tools: BIRT, Cognos Reporting, and Query Based Reports (Ad Hoc). The platform allows you to integrate external reporting systems, such as: Hyperion, Information Builders, SAS, Oracle BI and many others. We have already covered in our previous article how to extend the standard functionality of the IBM Maximo system (Ad Hoc) and allow users to download data from tables with a given set of attributes in Excel. In this article will talk about an alternative way of generating Excel reports in IBM Maximo.

Standard reporting systems have a number of shortcomings that encourage developers to develop their own solutions. To such disadvantages it is possible to carry the following:

  1. There is no way to quickly make changes to the report template.
  2. It’s hard to adapt report layout to export properly in Excel.

The solution described in this article has a very simple idea – it generates .xlsx reports based on the templates provided by end users. I.e. a user uploads an .xlsx template with data placeholders and Maximo immediately generates a filled in .xlsx report based on the uploaded template. The solution has obvious benefits:

  1. Users can independently develop and edit report templates, having mapping of attributes of business objects.
  2. The ability to create the report design (template) with the standard tools of MS Office Excel: management of markup, styling, support of non-standard fonts.

Custom solution

With the help of this enhancement you can generate .xlsx reports from Maximo applications. You create a template in Excel, format as you wish and put placeholders using a specific syntax. Simple placeholders take the format {{attribute}}, where attribute is a name of the attribute of the main Maximo business object. Placeholders can contain the name of the relationship from the main Mbo object. Here is all the supported syntax variations:

  1. {{attribute}}
  2. {{RELATIONSHIP.attribute}}
  3. {{RELATIONSHIP_1.RELATIONSHIP_2…RELATIONSHIP_N.attribute}}

It is important to note that report is generated on client side with the help of JavaScript library js-xlsx that supports custom styling. The enhancement should work correctly in browsers listed below:

  • IE 8/9/10/11 using Base64 mode (IE 10/11 using HTML5 mode)
  • FF 18+ (using Base64 or HTML5 mode)
  • Chrome 24+ (using Base64 or HTML5 mode)

Steps needed to inject enhancement to IBM Maximo

  • Download Gson library and put gson-2.8.2.jar file to:
..\maximouiweb.war\WEB-INF\lib\

<control-descriptor name="xlsxtemplate">
	<property-list>
		<property name="display" type="xsd:boolean">
			<flag name="global" />
			<default-value>true</default-value>
		</property>
		<property name="id">
			<flag name="final" />
		</property>
	</property-list>
	<component-list>
		<components id="${name}_components_v" layout="vertical">
			<components id="${name}_components_h" layout="horizontal" makevertical="true">
				<iframe id="${name}_iframe" scroll="no" width="400" height="300" src="/webclient/utility/xlsxtemplate.jsp" takesfocus="true" />
			</components>
		</components>
	</component-list>
	<containers>
		<container name="dialog" />
		<container name="section" />
		<container name="sectioncol" />
	</containers>
</control-descriptor>
..\maximouiweb.war\webclient\utility\

Usage example

Export application definition using Application Designer and add the following lines to the application .xml file:

  • Register report generation dialog:

...
<dialog id="report-generator-dialog">
	<xlsxtemplate id="report-generator-form"/>
</dialog>
...
  • Add button to open dialog:

<pushbutton id="report-generator-btn" label="Reports" mxevent="report-generator-dialog"/>
  • Import .xml file back to Maximo

How it works?

  • User prepares .xlsx template for a specific Maximo application in Excel:

  • Then upload template to system through report generation form:

  • The system collects data and returns to the client JSON object with data for placeholders. On the client side a new .xlsx file generates with substituted placeholders.

Conclusion

The article describes a fast and completely working solution for generating simple reports in IBM Maximo. In the next article I’ll tell you how this solution can be further developed so that more complex reports can be generated.


If you are looking for customizing your IBM Maximo platform, please feel free to reach us at http://www.maximoaddons.com/about-us to see how we can best address your needs.