Thursday, October 31, 2013

Create a Lookup with table domain in Maximo 7.5.0.5

Goal:
To use a lookup in the Labor application on workorders with a custom created field.

Example:
For each Qualification linked to a Labor we want to record a workorder number. It must be an existing workorder number so the user must select this number from a lookup. The workorder cannot be in status ‘WAPPR’ assigning it.

How to:

Step 1 - Create Table domain

Go the Domains application (located in Sytem Configuration -> Platform Configuration) and click on the 'Add New Domain' button at the bottom right and choose ‘Add New Table Domain’

In the ‘Validation Where Clause’ we state that the entered Workorder number (Will be stored in GNZ_LQWONUM, look below in this post for the configuration of this field) is compared to the workorder number in the workorder table.

WONUM=:GNZ_LQWONUM

In the list the user will get we only want to show workorders that do not have the status WAPPR. Therefor we we fill in the ‘List Where Clause’

STATUS<>'WAPPR'



Click [OK] and click on the Save icon in the Domains application


Step 2 - Create a Lookup

Now we need to create the lookup which will show the values of the table domain. Go to the Application Designer application (located in System Configuraion -> Platform Configuration) and in the ‘Select Action’ menu choose ‘Export System XML’
Click on the export arrow behind the LOOKUPS rows



Make sure your browser allows popups so the LOOKUPS.XML can be showed by Maximo. Or maybe your browser wants to save the file directly, if so, do so. 
Otherwise, safe the opened LOOKUPS.XML to a location where you can easily locate it again (e.g. desktop)

Now we open the LOOKUPS.XML for editing. (I use Notepad++)
Scroll all the way down and add the following table: 

<table id="GNZ_WONUM" inputmode="readonly" selectmode="single">
<tablebody displayrowsperpage="20" filterable="true" filterexpanded="true" id="GNZ_WONUM_lookup_tablebody">
<tablecol dataattribute="wonum" id="GNZ_WONUM_lookup_tablebody_col_2" mxevent="selectrecord" mxevent_desc="Go To %1" sortable="true" type="link"/>
<tablecol dataattribute="description" id="GNZ_WONUM_lookup_tablebody_col_3" mxevent="selectrecord" mxevent_desc="Go To %1" sortable="true" type="link"/>
<tablecol dataattribute="reportdate" id="GNZ_WONUM_lookup_tablebody_col_4" mxevent="selectrecord" mxevent_desc="Go To %1" sortable="true" type="link"/>
<tablecol dataattribute="siteid" id="GNZ_WONUM_lookup_tablebody_col_5" mxevent="selectrecord" mxevent_desc="Go To %1" sortable="true" type="link"/>
</tablebody>
</table>

Essentially I copy-pasted the existing 'workorder' table in the LOOKUPS.XML and changed the 'workorder' names to 'GNZ_WONUM'



Save the LOOKUPS.XML and in Maximo go to the Application Designer.
Click on the 'Import Application Definition' icon. 



Browse to the modified LOOKUPS.XML and import it.





Step 3 - Configure the (Object) Database Attribute

Next we add a database attribute on the Labor - Qualification in which we store the workorder number.

Open the 'Database Configuration' application (located in System Configuration -> Platform Configuration) and in there open the LABORQUAL object and go to the 'Attributes' tab.
In the bottom right click the [New Row]  button



Fill in the attribute like in the screenshot below




I use the 'Same as Object' and 'Same as Attribute' fields so the 'Type' and 'Length' will always be able to store Work Order numbers. When the WORKORDER.WONUM field should be modified, this field is modified automically.

Click on the Save icon and go back to the 'List' tab. Do an empty search and the LABORQUAL obejct will come out on top with the status 'To Be Changed' 




In the 'Select Action' menu choose 'Manage Admin Mode' and click on the [Turn Admin Mode ON] button.




Wait until the Admin mode is on and click [Close]

Now in the 'Select Action' menu choose 'Apply Configuration Changes' 
Check the 'Do you have a current backup?' box and click on the [Start Configuring the Database] 




When completed, click on the [OK]  button.
Choose 'Manage Admin Mode' again from the 'Select Action' menu and turn admin mode off.


Step 4 - Configure the MAXLOOKUPMAP

Open the LABORQUAL Object again and go to the Attributes tab.
At the far right of the GNZ_LQWONUM field, click on the 'Edit Lookup Map' icon.




Fill in the information required to link the fields:




Click [OK]  when done and make sure to save the Object.

Login to the Websphere Integrated Solution Console and restart the 'MXServer' 





Step 5 - Configure the field in Application Designer

Open the Application Designer application. and open the LABOR application.

Go to the Qualification tab and make a copy of the Certificate# field. Edit the properties of the field to match them as in the screenshot below.




Save the Application.

Now for the check if everything works.
Go to the Labor application and open an Active labor.

Go to the Qualifications tab. Add a new row and check the Work Order field with the lookup:





GNZ.