Design guidance needed

I am working on building some screens to view inventory in rice bins. Each bin can hold from 1 - 30 loads. Each load has a moisture value that we track when transferred to the bin. I am trying to figure the best way to be able to log each loads moisture value going into a bin and be able display an average moisture of the bin. These values are entered manually not OPC values. What is the most effieceint way to set things up get the average and ignore the values as zero? I tried using MySql but I would then need to transpose the data to get averages. I tried creating tags for each load but writing an expression to calculate the average and ignoring zero gets hairy. Just looking for other suggestions or ideas I may be overlooking.

I would use a dataset to hold the data for each load, and a table to display the current loads.

You could allow data entry below the table for new loads with an Add button that appended a row to the dataset.

Then create an Average tag with an expression to calculate the average. Use the sum function, and divide by data.rowCount.

Do you need to go back and look at when these loads were put into the system? If so, I would look at storing this in a database table. Also it would be easy to query the results out of the table and use a python script to cull out the zero values and only run an avg on the values that arent zero. If you have no need to store this data historically it would be fine to use a dataset.

If the table/tag layout is consistent, you can use a loop to skip through columns with a Range.
___for cellValue in range(2,30,2):
______#check values and calculate average.

I’m a database guy so if I were reading non-normalized data in a table, something like this would work:
resultSet = system.dataset.toDataSet(system.db.runQuery( sql, db ))
cols = system.dataset.getColumnHeaders(resultSet)
moistureCount = 0
moistureSum = 0
for row in range(resultSet.rowCount):
__for colName in cols:
____if colName.find(‘moist’) > 0:
____moisture = resultSet.getValueAt(0,colName)
____if moisture > 0:
______moistureCount = moistureCount + 1
______moistureSum = resultSet.getValueAt(0,colName)

I ended up creating screens to have operators enter the data into a database that was pretty much how I needed to extract it out.