Table Data Manipulation

So I think I am having a brain fart, but this is what I would like to do within Ignition using datasets and tables and nothing comes to mind -

I want to take an hourly reading of a tank level (using tag history) - use that to get the volume of the tank in gallons and then subtract it from the previous reading to get the gallons consumed or added during the time interval.

At the moment nothing is coming to mind of how to do this in a somewhat straightforward fashion. I am hoping to use this data in a report.

I thought about doing a button that runs a script and populates another dataset and loops through the original table. I got stuck there because I couldn’t see how to pass the size of a dataset to the script.

Any tips or help would be greatly appreciated!

I would use Transaction Groups to accomplish your task. You would use two transaction groups and two database tables. One transaction group would log the current value every hour to a database table, the second transaction group would run a query against that table and store the hourly deviation in a second table.

I made a post about doing daily total calculations using this method that you should be able to adjust to your needs - inductiveautomation.com/forum/v … 25&t=10849

You can use built-in properties of the dataset to get the size for your script:

for row in range(dataset.rowCount): for col in range(dataset.columnCount): print dataset.getValueAt(row, col)

That’s out of the “Working with Different Datatypes” section of the help.

I agree that transaction groups would be the best, but I already have years of data that I want to do this to stored in the historian.

I will look at using the rowCount and ColumnCount - that be enough to get me where I want to go.