Your advise Tim, specifically looking at the where clause, got me thinking and I came up with an example script. This was a pretty fun challenge as it helped teach me a way we can accomplish this, especially on custom objects. I have to reiterate (as I put in the comments of the script above) that this impacts the PROBLEMCODE attribute inside of the application so that logic would have to be reimplemented. I would probably avoid actually doing this because it's on the out of the box field but the information is still useful all the same.
The Maximo framework has the ability to retrieve the QBE for attributes. So implementing when someone has provided an = sign (meaning exact search), without having multiple values (no comma), you can then get the failure code and apply that as a filter.
# NOTE: This only handles list/advanced search. You would need to recreate the logic when it's not on the advanced search
from psdi.mbo import SqlFormat
from java.lang import String
# Set static attributes needed for getList
relationObject="FAILURELIST"
relationWhere="failurecode=:problemcode"
srcKeys=["FAILURECODE"]
targetKeys=["PROBLEMCODE"]
def getQbe(attribute):
filter=""
woSet=mbo.getThisMboSet()
# Check if QBE starts with an equal sign (meaning exact) and no comma list (IE multi-value)
if woSet.getQbe(attribute) and String(woSet.getQbe(attribute)).startsWith("=") and not String(woSet.getQbe(attribute)).contains(","):
qbe=woSet.getQbe(attribute)
# Remove equal sign
qbe=qbe[1:]
sqf=SqlFormat("failurecode=:1")
sqf.setObject(1,"FAILURELIST","FAILURECODE",qbe)
filter=sqf.format()
return filter
if mbo.isZombie():
# Change object to FAILURECODE as that is what is used for the lookups
relationObject="FAILURECODE"
whereClause=""
# Try and get QBE filter for FAILURECODE to provide a better filter
failureFilter=getQbe("FAILURECODE")
if failureFilter:
listWhere="failurecode in(select failurecode from failurelist WHERE parent=(SELECT failurelist FROM failurelist WHERE " + failureFilter+" ) and type in ( select value from synonymdomain where domainid='FAILTYPE' and maxvalue='PROBLEM') )"
else:
listWhere="failurecode in(select failurecode from failurelist where parent is not null and type in ( select value from synonymdomain where domainid='FAILTYPE' and maxvalue='PROBLEM') )"
------------------------------
Steven Shull
Director of Development
Projetech Inc
Cincinnati OH
------------------------------
Original Message:
Sent: Wed March 10, 2021 10:35 AM
From: Tim Ferrill
Subject: Failure Reporting Search on Work Order Tracking Advanced Search
I agree that there's no way to limit to just the Advanced Search, but I have had success in limiting to just the list tab, which in this case is the same thing functionally. I have seen fields with a class defined cause problems with a Retrieve List script, so that is another concern. One possible workaround is to add a non-persistent field and populate that dynamically with a Formula.
The one limitation I'm not sure about is looking back at the existing values in the Advanced Search dialog. You *might* be able to reach back to the owner and see what where clause is applied, but that's going to take some trial and error to get right if it is possible.
------------------------------
Tim Ferrill
Solutions Consultant
Intelligent Technology Solutions
tferrill@webuildits.com
www.webuildits.com
@tferrill/@webuildits
Original Message:
Sent: Wed March 10, 2021 08:13 AM
From: Steven Shull
Subject: Failure Reporting Search on Work Order Tracking Advanced Search
With an Automation Script, you can define a different filter (IE don't filter by ORGID in advanced search but filter by ORGID on a record) and you can use certain variables (such as the user, personid, etc.) but you can't retrieve a value from another field in the advanced search. It's not a real record, so doing something like mbo.getString("FAILURECODE") or utilizing it in the set (failurecode=:failurecode for example) won't work. In addition, there's no way to do it just for the Advanced Search. Creating an automation script will affect the application as well so we don't recommend doing it on out of the box fields typically.
The reason for this limitation (IMO) is they can't validate the values provided. You may have a single value (=BLDG for example) but by design that's not a real limit. Without the = sign it might be a wildcard search which would result in 0-X number of records, or you may even have a comma separated value list (=BLDG, =PIPE, =TURBINE, etc.). Making fields work in that scenario isn't possible.
There are third party products that support this but there's no way with the Maximo framework itself.
------------------------------
Steven Shull
Director of Development
Projetech Inc
Cincinnati OH
Original Message:
Sent: Tue March 09, 2021 04:28 PM
From: Mary Mangieri
Subject: Failure Reporting Search on Work Order Tracking Advanced Search
Thank you. I have the relationships set up. I will give the table domain a try.
Original Message:
Sent: 3/8/2021 5:32:00 PM
From: Tim Ferrill
Subject: RE: Failure Reporting Search on Work Order Tracking Advanced Search
The Cause/Remedy field should just be a matter of defining a relationship in Database Configuration and then configuring the field in Application Designer.
Dynamically filtering the lists could be tricky, but you may be able to make that work using Automation Scripts or potentially even Table domains.
------------------------------
Tim Ferrill
Original Message:
Sent: Thu March 04, 2021 02:12 PM
From: Mary Mangieri
Subject: Failure Reporting Search on Work Order Tracking Advanced Search
I need to add the ability to search failure reporting in work order tracking advanced search. I have the search for Failure and Problem right now, since those are on the work order table. I need a way to search for Cause and/or Remedy and find work orders where the failure reporting matches. My customer would ideally like to select Failure, then select a Problem from a list filtered by Failure, then Cause, then Remedy. Or something along those lines.
IBM suggested this could be done with an automation script?
I would appreciate any suggestions.
Thank you,
Mary
------------------------------
Mary Mangieri
Sarasota County Government
Sarasota FL
------------------------------
#AssetandFacilitiesManagement
#Maximo