Skip to main content
Solved

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

  • Jan 29, 2020 11:54 AM UTC
  • 5 replies
  • 296 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. 

View original

5 replies

Forum|alt.badge.img+7
  • Hero
  • Jan 29, 2020 10:55 PM UTC

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)
  • Jan 30, 2020 3:42 AM UTC

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)
  • Answer
  • Jan 31, 2020 11:34 AM UTC

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)
  • Feb 23, 2020 8:46 AM UTC

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)
  • Feb 24, 2020 8:08 PM UTC

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