Object Quick Summary

One of the customer that I'm working with is heavily relying on work logs. Unfortunately, the work logs are displayed in a standard table so there is no way of quickly displaying all the logs entered by the users.



The solution I have designed is a QuickSummary tab in the Work Order Tracking application that displays the main attributes of the selected work order together with the historical work logs in one single text box.



The described solution relies on the Rich Text editor control available in TPAE 7.5 but can be easily adapted to a standard multiline text box available in previous version of Maximo.
Here are the configuration steps.


Database Configuration

The first step is to define a virtual (non persistent) attribute that will be used to display the work order summary text.

Open WORKORDER object in Database Configuration and add the following attribute.
Save and apply database changes.


Application Designer

The second step is to add a new tab to the WOTRACK application that contains just a large texbox that will display the attribute defined above.

Open WOTRACK application in Application Designer and export application XML. Open the wotrack.xml file with a text editor and add the following lines just before the </tabgroup></clientarea> tags.
Here is how the file should look like (the text in bold is what needs to be added).

  ...
  <tab id="summary" label="QuickSummary">
    <section id="summary_s1">
      <richtexteditor dataattribute="WOSUMMARY" height="400" id="summary_s1_wosummary" plugins="[]" extra_plugins="[]"/>
    </section>
  </tab>
  </tabgroup>
  </clientarea>
  <include id="pageFooter"/>
</page>
...


Script

The last configuration steps is to create the script that will fill the WOSUMMARY field and attach it to the rich text control. The sample script retrieves all the necessary information from the work order and builds an HTML string that it is used to set the field value.

Goto System Configuration > Platform Configuration > Automation Scripts.
Select Action > Create Script and enter this information:

from java.lang import StringBuilder
from psdi.mbo import MboConstants


val = StringBuilder()

# retrieve attributes and writes them in HTML format in the buffer
val.append("ID: " + mbo.getString("WONUM") + "<br>")
val.append("Description: " + mbo.getString("DESCRIPTION") + "<br>")
val.append("Location: " + mbo.getString("LOCATION") + "<br>")
val.append("Asset: " + mbo.getString("ASSETNUM") + "<br><br>") 

# retrieve work log records and writes them in the buffer
worklogSet = mbo.getMboSet("MODIFYWORKLOG")

val.append("<hr>")
val.append("<h2>WORK LOG</h2>")
val.append("<hr>")

currMbo=worklogSet.moveFirst()

while currMbo is not None:
    
        val.append("<h3>" + currMbo.getString("DESCRIPTION") + "</h3><br>")
        val.append(currMbo.getString("DESCRIPTION_LONGDESCRIPTION") + "<br>")
        val.append("<hr>")
        currMbo=worklogSet.moveNext()
    

#  sets the formatted string in the attributes value
mbo.getMboValue("WOSUMMARY").setValue(val.toString(), MboConstants.NOACCESSCHECK | MboConstants.NOVALIDATION)

Click on the Create button.
Now you have to attach the script to the WOSUMMARY field. Select Action > Create Script with Object Launch Point and enter the following information:

Accept defaults on the other dialogs and create the launch point.

Now you are done. Open a sample Workorder and go the the QuickSummary tab and look at the results.


Further improvements

There are many ways to improve the QuickSummary feature.

Obviously you can extend the example to include your own fields and formatting to better fit your needs.

Look at how HTML tags have been used to format the output in the script. This means that you can improve the formatting of the summary to enhance readability.


Thanks to my colleague Dirk Hillmer who has helped me with TPAE scripting.

Labels: , ,