Maximo

 View Only
  • 1.  Failure Reporting Search on Work Order Tracking Advanced Search

    Posted Thu March 04, 2021 02:13 PM
    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
    ------------------------------


  • 2.  RE: Failure Reporting Search on Work Order Tracking Advanced Search

    Posted Tue March 09, 2021 03:49 PM
    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
    ------------------------------



  • 3.  RE: Failure Reporting Search on Work Order Tracking Advanced Search

    Posted Tue March 09, 2021 04:29 PM

    Thank you.  I have the relationships set up.  I will give the table domain a try.

     






  • 4.  RE: Failure Reporting Search on Work Order Tracking Advanced Search

    Posted Wed March 10, 2021 08:14 AM
    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
    ------------------------------



  • 5.  RE: Failure Reporting Search on Work Order Tracking Advanced Search

    Posted Wed March 10, 2021 08:33 AM

    Thank you Steven.  I guess I won't waste any time on this approach!

     






  • 6.  RE: Failure Reporting Search on Work Order Tracking Advanced Search

    Posted Wed March 10, 2021 10:35 AM
    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
    ------------------------------



  • 7.  RE: Failure Reporting Search on Work Order Tracking Advanced Search

    Posted Thu March 11, 2021 08:40 AM
    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
    ------------------------------



  • 8.  RE: Failure Reporting Search on Work Order Tracking Advanced Search

    Posted Thu March 11, 2021 08:53 AM
    Hi Steven,

    This looks interesting.  I'm assuming I could add the cause/remedy to this script? How would I implement this on advanced search? 

    Thank you,
    Mary

    ------------------------------
    Mary Mangieri
    Sarasota County Government
    Sarasota FL
    ------------------------------



  • 9.  RE: Failure Reporting Search on Work Order Tracking Advanced Search

    Posted Thu March 11, 2021 09:09 AM
    This is script utilizing the Retrieve List launch point on an attribute. So you create the automation script on the WORKORDER.PROBLEMCODE attribute with that launch point and it'll change the logic in the advanced search and on the actual work order. So you'd want to review the logic in the FldWOProblemCode and reimplement that as appropriate for your version if you want to go down this path (put an else: statement after the if mbo.isZombie() and put the logic there).

    Cause & Remedy are trickier as those aren't on WORKORDER. You'd have to define relationships to FAILUREREPORT (which is where those are stored), filtering for the type you want (IE CAUSE or REMEDY). And then create scripts on the FAILUREREPORT.FAILURECODE attribute where you'd have to look at the relationship name to determine whether you're looking at cause or remedy (since both would be on the same object/attribute).

    ------------------------------
    Steven Shull
    Director of Development
    Projetech Inc
    Cincinnati OH
    ------------------------------



  • 10.  RE: Failure Reporting Search on Work Order Tracking Advanced Search

    Posted Thu March 11, 2021 10:18 AM
    Nice job. I had it all working in my head, but didn't have the bandwidth yesterday to get it into a script.

    ------------------------------
    Tim Ferrill
    Solutions Consultant
    Intelligent Technology Solutions
    tferrill@webuildits.com
    www.webuildits.com
    @tferrill/@webuildits
    ------------------------------