Export to Excel from UI table with customized set of attributes

Basic Maximo functionality of downloading UI table content allows to export only the attributes displayed on the interface as table columns. Sometimes it may be necessary to export data with additional attributes that may belong either to the table MBO or to related MBO’s.

For example, we want to export related work orders from Service Request application.

If you export data via the “Download” link, the output xls file will contain only fields that are displayed in the table as columns:
– Work Order
– Description
– Class
– Status
– Relationship

The problem is that there is no standard way to include additional attributes to the export data (for example, WO Owner and Worktype description)

In this article I’ll describe how to implement a Maximo extension that will allow you to specify a set of attributes for xls export. Once the extension has been deployed, it will be possible to invoke it from any UI table and specify which attributes should be included for xls export from that table.

For implementation we need:
1) create dialog in LIBRARY.xml
2) create two bean classes and one servlet
3) make changes to web.xml file to register servlet
4) rebuild and redeploy maximo.ear

1) Dialog

This Dialog appears when event “exportxls” is fired from a UI table, e.g. with a table button. The underlying beanclass detects the MBO name behind the table that fired the event and builds the tree of object attributes and relationships. User selects the required attributes from the tree so that they appear in the table below the tree.
Add the following block to LIBRARY.xml to create the dialog:

<dialog id="exportxls" label="Select Fields" beanclass="custom.ui.beans.ExportXlsDialogBean" width="600">
	<section id="expreltree">
		<tree beanclass="custom.ui.beans.ExportRelTreeBean" height="300" id="expreltree1" maxchildren="5000" mboname="EXPBUILDTREE" restrictactionon="LEAF_NODES">
			<treenode displaykeyattribute="false" displayobjectname="false" id="expreltree11_node1" keyattribute="maxrelationshipid">
				<treeattribute dataattribute="name" display="true" id="expreltree11_node1_attr1"/>
				<treeattribute dataattribute="parent" id="expreltree11_node1_attr2"/>
	<table id="table_exportattr" label="Attributes" mboname="reportparameter" inputmode="readonly">
		<tablebody displayrowsperpage="12" id="table_exportattr_tablebody__1">
			<tablecol dataattribute="textparam1" id="table_exportattr_column__1" label="Attribute"/>
			<tablecol filterable="true" id="table_exportattr_deleterow__1" mxevent="toggledeleterow" mxevent_desc="Delete row" mxevent_icon="btn_garbage.gif" sortable="false" type="event"/>
	<buttongroup id="expbuttons">
		<pushbutton default="true" id="exptree2_1" label="Export" mxevent="export"/>
		<pushbutton default="false" id="exptree2_2" label="Cancel" mxevent="dialogcancel"/>


The dialog looks like this (if invoked from the Related Records table in the Service Requests application):

2) Java customization

One bean class is for the dialog. It processes the event from button in the dialog and launches the servlet.
The second bean class is for the tree of attributes. It handles the selection of attributes in the tree and populates the attributes table.
The servlet creates and populates Excel file and passes it to the user.
Bean classes should be placed in the directory:
Servlet should be placed in the directory:
Also, servlet requires jxl.jar library that should be placed in the directory:

3) web.xml

web.xml should be changed to register servlet and set servlet mapping.



4) maximo.ear

After changing web.xml file rebuild and redeploy of maximo.ear is required.

Usage Example

Now in order to export data from any UI table you only need to add one additional button for that table. The button has to fire the “exportxls” event.

Upon pressing the button the dialog will open as shown below. The dialog contains a tree with the list of object attributes and relationships. Select the object’s attributes that you want to include in the xls output. You may also select attributes that belong to objects related to the main object via expanding appropriate relationship. In our example, in the Service Request application related workorders are displayed via RELATEDRECORD object. So we select workorder attributes via relationship RELATEDRECWO. In order to get the worktype description we use the WORKTYPE relationship.

After all required attributes has been selected, press the “Export” button and the custom servlet will generate the XLS file: