PSQL interval data and report calculations

Using Ignition version 8.0.16.

I’ve got a report that is gathering interval data from a Postgsql database and I’d like to be able to have a summary row that uses calculations for that data.

However it seems that when I use that calculation it generates the in-correct time interval.

Any ideas on how to get it to show the correct summed up interval?

You might need to pull in an additional, hidden column of data in the form of an integer/float number of seconds. Run a total on that and format appropriately. I’m guessing the automatic sum function in the reporting system doesn’t know what to do with an interval (I’m guessing it comes in as text, not sure) One of the reports I have has a query like so:

select (extract(epoch from upper(workedindaterange)-lower(workedindaterange))/3600) as duration 

The duration is then in the form of hours/decimal part of an hour, which is fine for my purposes. To get your format, you might need to leave out the divide by 3600, and then do some formatting in the report to convert the number of seconds to HH:MM:SS format.

1 Like

that’s exactly what I did. I just wanted to try and do it more elegantly.

Thanks for the help.