I'm trying to show how long an outage lasted with the following statement. my boss wants to see the outcome as '1 day(s) 2 hour(s) 36 minute(s)'
The formula accepts everything until I add the Endif. then I get the malformed statement error in the subject. Thoughts?
'' IF Average([Outage Duration (Seconds)]) < 3600
THEN
//Convert from Seconds to Minutes
"0 Day(s) 0 Hour(s) " + ToString(ToNumber(Average([Outage Duration (seconds)])/60)) + " Minute(s) "
ELSEIF Average([Outage Duration (seconds)]) < 86400
THEN
//Convert from Seconds to Hours
"0 Day(s) " + ToString(ToNumber(Average([Outage Duration (seconds)])/3600)) + " Hour(s) " + ToString(ToNumber(Average([Outage Duration (seconds)])/3600)/60) + " Minute(s)"
ELSE
//Convert from Seconds to Days
ToString(ToNumber(Average([Outage Duration (seconds)]) / 86400)) + 'Day(s)' + ToString(ToNumber(Average([Outage Duration (seconds)]) / 86400) / 3600) + "Hour(s) "+ ToString((ToNumber(Average([Outage Duration (seconds)]) /86400) / 3600) / 60) + "Minute(s)"
endif "
Thanks for the help!
Solved! Go to Solution.
@DavidP wrote:This is how I would do it.
I made it way more complicated than necessary! Thank you so much!