IBM Support

Using views for table domain and custom lookup

Technical Blog Post


Abstract

Using views for table domain and custom lookup

Body

You may need to use a custom view for a special requirement and setup a lookup for the field.

Create a View for an Example I have created a custom view PERSON_MAINT

Create a database view with the following definition

Create or replace view person_maint as select personid RISK_OWNER, displayname name, 'PERSON' owner_type from person where status = 'ACTIVE' union select value RISK_OWNER, description name, 'PERSON_MAINT' owner_type From synonymdomain where domainid = 'PERSON_MAINT' order by owner_type ;

Create a custom object/view in Maximo with the same name, and Maximo will import the database view

image

 

 

 

 

 

 

 

 

 

View where

status = 'ACTIVE' union select value RISK_OWNER, description name, 'PERSON_MAINT ' owner_type From synonymdomain where domainid = 'PERSON_MAINT ' order by owner_type

View Select

select personid RISK_OWNER, displayname name, 'PERSON' owner_type

View From

from person

Create a Table Domainon PERSON_MAINT Object PERSON_MAINT

image

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Add a new entry to LOOKUPNAMES ALNDomain

image

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Go to Classification

Add Use With Object SR

Add the attribute

image

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Go to Application Designer

Import the lookups.xml

Edit the file to include the below

<table id="PERSON_MAINT" inputmode="readonly" selectmode="single">

<tablebody displayrowsperpage="20" filterable="true" filterexpanded="true" id="PERSON_MAINT_lookup_tablebody">

<tablecol dataattribute="risk_owner" id="PERSON_MAINT_lookup_tablebody_col_2" mxevent="selectrecord" mxevent_desc="Go To %1" sortable="true" type="link"/>

<tablecol dataattribute="name" id="PERSON_MAINT_lookup_tablebody_col_3" mxevent="selectrecord" mxevent_desc="Go To %1" sortable="true" type="link"/>

<tablecol dataattribute="owner_type" id="GPERSON_MAINT_lookup_tablebody_col_4" mxevent="selectrecord" mxevent_desc="Go To %1" sortable="true" type="link"/>

</tablebody>

</table>

Save and Import lookups.xml

 

1. Go to SR create a new SR

2. Click Specifications Tab

3. For the field Classification Go to Classifications and select OIL return with value

4. Under attribute table expand the RISKOWNE attribute select detail menu for Table Value field.

The filter is NOT available in the lookup list. The reason is the attribute should have a search type. Even though the lookups.xml file set to filterable="true".

In order to have a search type perform the followings.

update maxattribute set searchtype='WILDCARD' where objectname='PERSON_MAINT' and attributename='RISK_OWNER'; 
 
update maxattributecfg set searchtype='WILDCARD' where objectname='PERSON_MAINT' and  attributename='RISK_OWNER'; 
 
commit; 

After the successful update stop the server and restart the application server.

Now perform the steps as above mentioned the lookup will have the field filterable.

image

 

 

 

 

[{"Business Unit":{"code":"BU005","label":"IoT"}, "Product":{"code":"SSLKT6","label":"Maximo Asset Management"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":""}]

UID

ibm11130091