Maximo Open Forum

  • 1.  Where Clause in SR app that pulls related work orders with a persongroup

    Posted 08-27-2024 22:12

    I am trying to set up a portlet that would show SRs that have a related workorder with a particular workgroup on the related workorder.

    I know I want to use this as the base of the where clause---how do I add in the criteria for a particular persongroup on the workorder?

    ((status = 'QUEUED' ) and (exists (select rel.recordkey from relatedrecord rel where rel.recordkey = ticketid and rel.relatedrecclass = 'WORKORDER'))) 


    #Administration
    #MaximoApplicationSuite
    #WorkManagement

    ------------------------------
    Julia Scott
    Sarasota County Government
    ------------------------------


  • 2.  RE: Where Clause in SR app that pulls related work orders with a persongroup

    Posted 08-28-2024 10:49

    Hey Julia,

    Try this and let me know if it gives you what you're expecting:

    ((status = 'QUEUED') 
    and exists 
      (select 1 
       from relatedrecord rel 
       join workorder wo on rel.relatedreckey = wo.wonum 
       where rel.recordkey = ticketid 
         and rel.relatedrecclass = 'WORKORDER' 
         and wo.persongroup = 'group_name_here'))

    Cheers,



    ------------------------------
    Matt F
    ------------------------------



  • 3.  RE: Where Clause in SR app that pulls related work orders with a persongroup

    Posted 08-28-2024 11:12

    Hi---thank you, Matt.  I am trying the following but am getting the error:  

    I can run the where clause in SSMS and get results

    (status <> 'RESOLVED')
    and 
    (exists 
      (select 1 
       from relatedrecord rel 
       join workorder wo on wo.wonum = rel.relatedreckey 
       where rel.recordkey = ticketid 
       and rel.relatedrecclass = 'WORKORDER'
       and wo.persongroup = 'ITPM' 
       )
    )
    and 
    ((commoditygroup = 'WASTEWATER' or commoditygroup = 'POTABLE'))



    ------------------------------
    Julia Scott
    Sarasota County Government
    ------------------------------



  • 4.  RE: Where Clause in SR app that pulls related work orders with a persongroup

    Posted 08-28-2024 11:26
    Edited by Matt F 08-28-2024 11:26

    Hey Julia,

    Is there anything else formatting the whereclause incorrectly? Can you check your logs? Even when I test yours as is, I get the standard message of: 

    BMXAA4186E - No records were found that match the specified query

    Which means that it's formatting and executing properly, just not returning results as I have none which match your search criteria.



    ------------------------------
    Matt F
    ------------------------------



  • 5.  RE: Where Clause in SR app that pulls related work orders with a persongroup

    Posted 08-28-2024 11:30
    Edited by Julia Scott 08-28-2024 11:30

    Good call.  We just had the SCCD piece removed and perhaps there are some broken relationships.  It would seem to me that if it works in SQL, that it would work in Maximo.  We are currently in 761 moving to MAS8 soon.  I do appreciate your time!



    ------------------------------
    Julia Scott
    Sarasota County Government
    ------------------------------



  • 6.  RE: Where Clause in SR app that pulls related work orders with a persongroup

    Posted 08-28-2024 11:42

    True enough. No problem!

    Sometimes the quotations (single/double) can also be impacted if you're copying/pasting SQL or code between different systems. Cheers!



    ------------------------------
    Matt F
    ------------------------------