This might be something good to look at. http://forum.inductiveautomation.com/t/insert-power-table-into-db-table/18369