I have been reading some posts on here but none of them quite answer what I am looking for. I want to build a model so that I can use it as a geoprocessing tool in a web app later that will allow the user to draw a polygon to select features on a map, and will then calculate a value for each feature based on an equation and 2 fields in the attribute table of the features, and then return a sum of all of those values.
I did not need the values to be permanently appended to the existing table, or a new layer created. What the data represents is tree inventory with tree height and diameter for each tree. I have a formula to calculate CO2 sequester amounts for each tree based on their height and diameter. I want the user to be able to draw a polygon to select trees and be returned a number representing the sum of CO2 sequestered in the selected trees contained in the polygon they drew. I wanted to build it this way since the inventory does not already calculate CO2, but they do record height and diameter, so this tool could be used without changing or adding to the original tree inventory database.
Not sure about displaying data in web apps but what if you created a new table that gets overwritten each time (or create it in-memory) the polygon is drawn and the numbers are calculated? To create the table/feature class you could have the user draw a polygon using the feature-set parameter in modelbuilder or using a python script tool. Then use that polygon to select features from the tree feature class, using the selected features create a table to use for calculations (using add field and calculate field) and display.