Maximo Open Forum

 View Only
  • 1.  Where clause for a view

    Posted 09-29-2025 13:01

    Is there a difference in how we query a table and one of it's views? I'm trying to search for work order tasks with the word "replace" in it. It doesn't seem to follow the typical child table search (exists (select...)) or maybe where clause skills aren't that great. The WOACTIVITY (where tasks live) is a view of the WORKORDER table and not quite sure what it should look like.


    #Administration

    ------------------------------
    Jason Johnson
    RSI
    ------------------------------


  • 2.  RE: Where clause for a view

    Posted 09-30-2025 10:00

    You havent stated where you are looking?  Are you looking for the info to be returned on the work order application? If I understand you correctly you could use...

    WONUM IN (SELECT WONUM FROM WOACTIVITY WHERE UPPER(DESCRIPTION) LIKE '%REPLACE%')


    ------------------------------
    Simon McAnsh
    Ineos FPS
    ------------------------------



  • 3.  RE: Where clause for a view
    Best Answer

    Posted 09-30-2025 20:39

    Hi Jason,

    From the work order tracking, it filters out task work orders, even though the WOCLASS is WORKORDER and ACTIVITY.  Task work orders have a WOCLASS of ACTIVITY, but they also have ISTASK = 1.  So, if you're looking to search for the task description, then you'll need to go into the advanced search and either remove the flag on Is Task or set it to 1.

    In the Activities and Task application, you should be able to search without the need to change the criteria, just enter "replace" into the summary field.  Please note that the Work Order number you see in this application is the owner work order's number, not the task's work order number.  For instance, I create a task T1735 on work order 1934, I would see 1934 as the work order.

    From the work order tracking application, if I remove the ISTASK flag and search for anything that has a description of "replace", this is the SQL that results:

    ((woclass = 'WORKORDER' or woclass = 'ACTIVITY') and upper(description) like '%REPLACE%' and historyflag = 0 and siteid = 'BEDFORD')

    As you can see, there is no child; this is because they are all in the same table, as they are all work orders.  The link for a:

    • Child work order is the WORKORDER.PARENT field, but the ISTASK=0 and WOCLASS=ACTIVITY
    • Task work order is the WORKORDER.PARENT field, but the ISTASK=1 and WOCLASS=ACTIVITY



    ------------------------------
    Craig Kokay
    Principal Consultant
    COSOL

    email: craig.kokay@cosol.global
    #IBMChampion
    ------------------------------



  • 4.  RE: Where clause for a view

    Posted 10-01-2025 14:00

    Thank you, Craig. That worked! And thank you for the explanation.



    ------------------------------
    Jason Johnson
    RSI
    ------------------------------