Tweaked. Try again. (I don't have a SQL Server running here at the moment.)
(Also, please fix your preformat placement on your last dataset.)
Tweaked. Try again. (I don't have a SQL Server running here at the moment.)
(Also, please fix your preformat placement on your last dataset.)
"#NAMES"
"Charging","clipped_t_stamp","clipped_t_next"
"#TYPES"
"I","date","date"
"#ROWS","53"
"0","2024-07-31 07:00:00.000","2024-07-31 08:11:05.616"
"1","2024-07-31 08:11:05.616","2024-07-31 08:11:43.786"
"0","2024-07-31 08:11:43.786","2024-07-31 08:19:34.506"
"1","2024-07-31 08:19:34.506","2024-07-31 08:20:05.536"
"0","2024-07-31 08:20:05.536","2024-07-31 08:20:35.573"
"1","2024-07-31 08:20:35.573","2024-07-31 08:23:20.950"
"0","2024-07-31 08:23:20.950","2024-07-31 08:23:40.973"
"1","2024-07-31 08:23:40.973","2024-07-31 08:29:07.783"
"0","2024-07-31 08:29:07.783","2024-07-31 08:29:23.806"
"1","2024-07-31 08:29:23.806","2024-07-31 08:34:03.356"
"0","2024-07-31 08:34:03.356","2024-07-31 08:35:09.556"
"1","2024-07-31 08:35:09.556","2024-07-31 08:40:33.230"
"0","2024-07-31 08:40:33.230","2024-07-31 08:40:48.246"
"1","2024-07-31 08:40:48.246","2024-07-31 08:47:50.026"
"0","2024-07-31 08:47:50.026","2024-07-31 08:48:05.070"
"1","2024-07-31 08:48:05.070","2024-07-31 08:48:36.110"
"0","2024-07-31 08:48:36.110","2024-07-31 08:54:56.516"
"1","2024-07-31 08:54:56.516","2024-07-31 08:55:34.563"
"0","2024-07-31 08:55:34.563","2024-07-31 10:02:51.380"
"1","2024-07-31 10:02:51.380","2024-07-31 10:14:33.646"
"0","2024-07-31 10:14:33.646","2024-07-31 12:14:58.550"
"1","2024-07-31 12:14:58.550","2024-07-31 12:16:55.506"
"0","2024-07-31 12:16:55.506","2024-07-31 12:37:05.820"
"1","2024-07-31 12:37:05.820","2024-07-31 12:37:22.966"
"0","2024-07-31 12:37:22.966","2024-07-31 12:48:53.966"
"1","2024-07-31 12:48:53.966","2024-07-31 12:53:42.036"
"0","2024-07-31 12:53:42.036","2024-07-31 12:54:06.063"
"1","2024-07-31 12:54:06.063","2024-07-31 12:58:21.620"
"0","2024-07-31 12:58:21.620","2024-07-31 12:58:48.646"
"1","2024-07-31 12:58:48.646","2024-07-31 12:59:35.700"
"0","2024-07-31 12:59:35.700","2024-07-31 12:59:59.773"
"1","2024-07-31 12:59:59.773","2024-07-31 13:03:04.630"
"0","2024-07-31 13:03:04.630","2024-07-31 13:03:28.686"
"1","2024-07-31 13:03:28.686","2024-07-31 13:03:35.850"
"0","2024-07-31 13:03:35.850","2024-07-31 13:03:55.870"
"1","2024-07-31 13:03:55.870","2024-07-31 13:06:35.383"
"0","2024-07-31 13:06:35.383","2024-07-31 13:06:49.396"
"1","2024-07-31 13:06:49.396","2024-07-31 13:12:45.470"
"0","2024-07-31 13:12:45.470","2024-07-31 13:12:59.533"
"1","2024-07-31 13:12:59.533","2024-07-31 13:18:00.960"
"0","2024-07-31 13:18:00.960","2024-07-31 17:20:17.993"
"1","2024-07-31 17:20:17.993","2024-07-31 17:20:32.006"
"0","2024-07-31 17:20:32.006","2024-07-31 17:49:51.453"
"1","2024-07-31 17:49:51.453","2024-07-31 17:51:34.746"
"0","2024-07-31 17:51:34.746","2024-07-31 17:51:59.866"
"1","2024-07-31 17:51:59.866","2024-07-31 18:02:22.936"
"0","2024-07-31 18:02:22.936","2024-07-31 18:08:47.756"
"1","2024-07-31 18:08:47.756","2024-07-31 18:15:36.600"
"0","2024-07-31 18:15:36.600","2024-07-31 18:15:51.616"
"1","2024-07-31 18:15:51.616","2024-07-31 18:26:04.036"
"0","2024-07-31 18:26:04.036","2024-07-31 23:37:56.060"
"1","2024-07-31 23:37:56.060","2024-07-31 23:38:08.073"
"0","2024-07-31 23:38:08.073","2024-08-01 07:00:00.000"
@pturmel Fix is working. Im not sure what you're asking for about preformat placement
So you should have a final dataset to share, with just two rows. The "Seconds" column should total 86,400 for the day.
You managed to capture some non-CSV content in the preformat section.
"#NAMES"
"Charging","PeriodStart","Seconds"
"#TYPES"
"I","date","D"
"#ROWS","2"
"0","2024-07-31 07:00:00.000","80534.785"
"1","2024-07-31 07:00:00.000","5865.215"
Ok all fixed
And we're basically done. If you don't care about non-charging time, then the SQL could be slightly more optimized.
No i dont care about it. Itll take me some time to decipher your code. But ill get a data set each day?
Whenever you open that view, it will generate a time frame for the prior data and run the NQ.
You can run the NQ from other contexts, like reporting.
If you want to merge multiple chargers into a single table, there would need to be another column in the table, and it would need to be checked in the OVER clause and in the grouping.
We've done enough for today--I have somewhere to be.
Ok. Thank you for your time.
@pturmel feel like having a class session?
Trying to get an exchange resource done before some travel. I'll let others carry the ball forward.