Skip to main content
Solved

I need to capture downtime/breakdown time in IFS10 maintenance for previous 7 days

  • January 29, 2020
  • 5 replies
  • 250 views

Forum|alt.badge.img+7

I am trying to capture the time of a maintenance WO between Fault Reported and Workdone status. Basically down time for the previous 7 days displayed on a lobby. I have built the lobby and i can record the downtime/ breakdown time for last week but not the last 7 days.

Best answer by DaveNorman

Thank you for all the responses, I will look at these shortly and let you know the results. 

5 replies

Forum|alt.badge.img+7
  • Hero
  • 69 replies
  • January 29, 2020

Maybe use something like below in an IAL and use the value of avg_down_time to show up on a counter element?

 

SELECT w.wo_no,
       MAX(CASE
             WHEN w.new_value = 'WORKDONE' THEN
              w.dt_cre
           END) - MAX(CASE
                        WHEN w.new_value = 'FAULTREPORT' THEN
                         w.dt_cre
                      END) down_time,
       AVG(MAX(CASE
                 WHEN w.new_value = 'WORKDONE' THEN
                  w.dt_cre
               END) - MAX(CASE
                            WHEN w.new_value = 'FAULTREPORT' THEN
                             w.dt_cre
                          END)) over() avg_down_time

  FROM work_order_journal w
 WHERE w.value_source = 'ActiveSeparate'
   AND w.new_value IN ('FAULTREPORT', 'WORKDONE') HAVING
 MAX(CASE
             WHEN w.new_value = 'FAULTREPORT' THEN
              w.dt_cre
           END) >= SYSDATE - 7
   AND MAX(CASE
             WHEN w.new_value = 'WORKDONE' THEN
              w.dt_cre
           END) - MAX(CASE
                        WHEN w.new_value = 'FAULTREPORT' THEN
                         w.dt_cre
                      END) IS NOT NULL
 GROUP BY w.wo_no
 


  • Superhero (Employee)
  • 1493 replies
  • January 30, 2020

I am trying to capture the time of a maintenance WO between Fault Reported and Workdone status. Basically down time for the previous 7 days displayed on a lobby. I have built the lobby and i can record the downtime/ breakdown time for last week but not the last 7 days.

Can you add a parameter in your lobby (with default value 7) and then add the same in your data source e.g. $days$, to limit the result by the number of days you specify in the parameter?

Would be helpful if you could post the query. 


Forum|alt.badge.img+7
  • Author
  • Sidekick (Customer)
  • 17 replies
  • Answer
  • January 31, 2020

Thank you for all the responses, I will look at these shortly and let you know the results. 


Forum|alt.badge.img+7
  • Author
  • Sidekick (Customer)
  • 17 replies
  • February 23, 2020

Maybe use something like below in an IAL and use the value of avg_down_time to show up on a counter element?

 

SELECT w.wo_no,
       MAX(CASE
             WHEN w.new_value = 'WORKDONE' THEN
              w.dt_cre
           END) - MAX(CASE
                        WHEN w.new_value = 'FAULTREPORT' THEN
                         w.dt_cre
                      END) down_time,
       AVG(MAX(CASE
                 WHEN w.new_value = 'WORKDONE' THEN
                  w.dt_cre
               END) - MAX(CASE
                            WHEN w.new_value = 'FAULTREPORT' THEN
                             w.dt_cre
                          END)) over() avg_down_time

  FROM work_order_journal w
 WHERE w.value_source = 'ActiveSeparate'
   AND w.new_value IN ('FAULTREPORT', 'WORKDONE') HAVING
 MAX(CASE
             WHEN w.new_value = 'FAULTREPORT' THEN
              w.dt_cre
           END) >= SYSDATE - 7
   AND MAX(CASE
             WHEN w.new_value = 'WORKDONE' THEN
              w.dt_cre
           END) - MAX(CASE
                        WHEN w.new_value = 'FAULTREPORT' THEN
                         w.dt_cre
                      END) IS NOT NULL
 GROUP BY w.wo_no
 

Thanks for this response; however, if i’m honest, it was a bit too complicated for me to follow. I will certainly keep a copy of this as i am continually gaining knowledge of IFS/SQL.  


eqbstal
Superhero (Partner)
Forum|alt.badge.img+21
  • Superhero (Partner)
  • 701 replies
  • February 24, 2020

DaveNorman,

Is it not an option to retrieve the dates from both statuses from the WO Journal? Subtract these two and you will have the downtime.

Regards,
Steve