Using Maximo search functionality can be sometimes complex or even frustrating.
Several customers have asked me if there is a simple Google-like functionality to search for all the objects that contains a specific set of words.
This article describes how to implement such feature in the Work Order Tracking application.
The solution described in this tutorial allows to display a simple search dialog when the user clicks on a specific button on the toolbar. When the user presses the ‘Search’ button the application will list the work orders containing all the keywords in any of the following fields: description, long description, location, asset, work logs.
Note that this is not achievable using the Advanced Search dialog since this will search with an AND logic instead of an OR logic implemented here.
In this screenshot you can see the custom search button and the very simple SmartSearch dialog.
The basic theory of how to create a custom dialog box to ask for user input is described in details in this article.
Create the custom Dialog Box
First of all we need to create the SmartSearch dialog box.
- Launch the Application Designer and open the WOTRACK application.
- Export the XML application definition to a local file.
- Open the exported file with a text editor.
- Scroll all the way down to the bottom of the file.
- Just before the </presentation> end tag, insert the XML code below.
- Save your changes.
- Go back to the Application Designer application.
- On the List tab, click on the Import Application Definition toolbar button to import your modified file.
Here is the dialog box definition.
<dialog beanclass="mxdev.webclient.beans.workorder.SmartSearchAppBean" id="ssearch" label="SmartSearch"> <section border="false" id="ssearch_s1" mboname="smartsearch"> <textbox dataattribute="searchtext" label="Text" id="ssearch_s1_1"/> <checkbox dataattribute="searchhist" label="Include historical records" id="ssearch_s1_2"/> <blankline id="ssearch_s1_3"/> </section> <buttongroup id="ssearch_buttons_1"> <pushbutton default="true" id="ssearch_btn1" label="Search" mxevent="dialogok"/> <pushbutton id="ssearch_btn2" label="Cancel" mxevent="dialogcancel"/> </buttongroup> </dialog>
Define the sigoption
Follow these steps to define the sigoption for the custom dialog box.
- Launch the Application Designer and open the WOTRACK application.
- On the Select Action menu, click on Add/Modify Signature Options.
- Click on New Row to add a new row:
Option: SSEARCH
Description: SmartSearch - Exit out the Application Designer application.
- Launch the Security Groups application and open “EVERYONE” group.
- Go to the Applications tab.
- Search fo Work Order Tracking application and then for the ‘SmartSearch’ the new signature option. Grant access to it and save your changes.
- Done.
Create toolbar button
Follow these steps to create a custom toolbar button to launch your dialog box.
- Launch the Application Designer application.
- Retrieve the application which you modified on step 2.
- On the Select Action menu, click on Add/Modify Toolbar Menu.
- Click on New Row to add a new row. Use the following values:
Element Type = OPTION
Key Value = SSEARCH
Position = 80
Subposition = 0
Image = find.gif
Visible = Yes
Tabs = LIST - Click OK..
- Logout and login back.
Checkpoint
Launch the Work Order Tracking application and check that the new button and that by clicking on it the new SmartSearch dialog is displayed. Note that at this point you will still see an ‘Invalid Binding’ error.
Create SMARTSEARCH object
Follow these steps to create a non persistent object to support the application bean.
- Launch Database Designer application.
- Create an new object and enter the following information
Object: SMARTSEARCH
Description: Non persistent bean for SmartSearch
Persistent: False - Save the record and go the the Attributes tab.
- Create the following attribute:
Attribute: SEARCHTEXT
Title: Search text
Type: ALN
Length: 100 - Create the following attribute:
Attribute: SEARCHHIST
Title: Include historical records
Type: YORN
Default: 0 - Save and apply database changes
SmartSearch AppBean class
Follow these steps to create and deploy the AppBean class.
- Download SmartSearchAppBean.java file.
- Open your development environment and copy SmartSearchAppBean.java into mxdev.webclient.beans.workorder package.
- Compile and copy SmartSearchAppBean.class file in
[SMPDIR]\applications\maximo\maximouiweb\webmodule\WEB-INF\classes\mxdev\webclient\beans\workorder - Re-build and deploy Maximo EAR file.
You can easily modify the set of fields in which the text is searched by modifying how the where clause string is built.
References
Custom Dialog Box tutorial (from Daniel NG)
Call Java method on action menu or toolbar button click
Thanks Bruno. I have been following your blog ever since my involvement with our 6.2 to 7.5 Upgrade. Your examples have helped me tremendously. I have tried your example above and it works great. BTW I'd love to see a post on creating a simple custom application in Maximo using all custom mbo's.
Good to see
Wonderful information. Thanks 🙂
Awesome Article,
When I try to search I get this error
BMXAA4210E – Database error number 8116 has occurred.
Argument data type text is invalid for argument 1 of upper function.
Hi Bruno I have to do same thing but in Maximo 6.2.1 and I can't find any info on how do this for that version. I tried out copying your example but didn't work. Any suggest, comments or info where to get javadocs for 6.2.x version will be welcome.
Thanks a lot for your time
Have you performance/load tested the smartsearch functionality if say it was implemented from the work orders module which can grow tremendously? What results did you get for a search on a large dataset?
Thanks Bruno,its a superb knowledge article
You are totally right, performances can become an issue for large volumes of data. The combination of UPPER/LIKE in the where clause leave little space for optimization in the db. Table scans are the only option.
However, not everybody has millions of work orders. Furthermore, the described technique can be used in other contexts as well where data is much less.
Hi Bruno,
Great to see this feature for workorder tracking…I believe you are using database Search to achieve the mentioned approach…Have you thought about using Lucene Search mechanism to create and maintain search index which will help you to improve the performance.
Yes sure. The where clause can be modified to take advantage of text search.
Hi Bruno,
I am not able to open the reference link for Custom Dialog Box tutorial (from Daniel NG), could you please provide the right once.
Thanks in advance..
Hi Bruno,
The link to java file SmartSearchAppBean.java is giving 404.
please update the link.
Regards,
Chetan
Fixed