What I appreciate the most is the possibility to use of
RelationShips in the SearchMore dialog box.
Maximo automatically replaces in the RelationShip any :bindingvariable with its counterpart in the Main MBo of your App.
A very useful example is for retrieving ALL PMs related to one Location Ancestor, whatever the PM is related to an asset and/or to a location. Here is the recipe :
1) Add a Relation From PM to LocAncestor, say
cust_primsyslocpm, with this WHERE CLAUSE :
systemid=(select systemid from locsystem where primarysystem='1' and siteid=:siteid) and siteid=:siteid and ((location=:location) or location=(select location from asset where siteid=:siteid and assetnum=:assetnum))2) Add this in the SearchMore dialog box of PM.XML
<textbox dataattribute="cust_primsyslocpm.ancestor" id="qbe_grid6_1_1_11_custo" inputmode="query" lookup="locations" menutype="locations" applink="location" label="Search REALLY by ancestor"/>3) Now, you are able to search for ALL PMS related to one ancestor (any PMs with asset related to this ancestor plus any PM related to this ancestor).
The RelationShip is indeed used and adapted "on the fly" by the Qbe.class with 2 actions :
- Replacement of any :bindingvariable with its counterpart in the Main MBo of your App,
- Addition of the criteria included in the SearchMore.
So this RelationShip,
systemid=(select systemid from locsystem where primarysystem='1' and siteid=:siteid) and siteid=:siteid and ((location=:location) or location=(select location from asset where siteid=:siteid and assetnum=:assetnum))enable the easy building of this WhereClause :
(siteid = 'BEDFORD') and (exists (select 1 from maximo.locancestor where ((ancestor like '%BOILER%')) and (systemid=(select systemid from locsystem where primarysystem='1' and siteid=pm.siteid) and siteid=pm.siteid and ((location=pm.location) or location=(select location from asset where siteid=pm.siteid and assetnum=pm.assetnum)))))
------------------------------
Hugues LOMBARD
------------------------------
Original Message:
Sent: Tue December 01, 2020 04:56 AM
From: User1971
Subject: Tips and tricks: SQL queries in Maximo?
Does anyone have any tips/tricks for SQL queries in Maximo that would be worth sharing?
So far, I've found a few resources that have been helpful:
1. https://community.ibm.com/community/user/imwuc/browse/blogs/blogviewer?BlogKey=14ca33fc-b99d-4cd2-b413-30248992ff41
2. https://www.ibm.com/support/knowledgecenter/SSFGJ4_7.6.0/com.ibm.mbs.doc/scheduler/r_sample_queries.html
3. Searching & Querying in Maximo
4. https://silo.tips/download/maximo-sql-queries-april-2016
5. Basic SQL optimisation knowledge that Maximo support staff should have
6. https://www.linkedin.com/pulse/additional-information-maximos-wildcard-search-type-mark-robbins
#Maximo
#AssetandFacilitiesManagement