Maximo Open Forum

 View Only
  • 1.  Selecting records for Result Sets or KPI's using Dates

    Posted 03-31-2023 12:50

    Good Afternoon,
     I trying to write a select statement to show all work orders opened based on current date or previous day or 30 days. If I try to use getdate() Maximno does not support. The below example is for previous day. This SQL script works perfectly in MS SQL Server Management Studio. 

    SELECT count(*) FROM [xxx].[xxx].[WORKORDER] where CONVERT(DATE,REPORTDATE) = CONVERT(DATE,GETDATE()-1) and ((woclass = 'WORKORDER' or woclass = 'ACTIVITY') and historyflag = 0 and istask = 0 and siteid = 'PHYSPLNT'); 

    Is there a better way to approach this query ?

    Much....Thanks


    #Reporting

    ------------------------------
    D Keith Henderson
    University of Louisville Physical Plant
    ------------------------------


  • 2.  RE: Selecting records for Result Sets or KPI's using Dates

    Posted 04-01-2023 16:19

    For something like this I would recommend you create the KPI from work order tracking. 

    First build where clause and test it and you will get something like:

    where ((woclass = 'WORKORDER' or woclass = 'ACTIVITY') and historyflag = 0 and istask = 0 and siteid = 'YOUR SITE ID') and reportdate > getdate()-30

    Verify it gets you the correct work orders and then hit the Create KPI button to build:


    Then you can fill in the blanks and be done. 

    The nice part about building the where clause in work order tracking is that you get to test it and verify it before building the KPI.



    ------------------------------
    Christopher Winston
    Projetech Inc.
    ------------------------------