Answered
avg, max, and min calculated from form data
I have two tables. One with raw data and one with summary
data. There is a form that the raw column data is input into then
on submit I use a cfloop function to get the data into the same
column in the raw data table. I can't seem to figure out an easy
way to calculate the max, min, and average values for the data that
is put into the raw data table that can be put into the summary
data table. The data is customized by location and date.
This is the code for getting the raw data into the table.
<CFLOOP INDEX="onerow" FROM="1" TO="#form.numrows#">
<CFQUERY NAME="insertrawdata" DATASOURCE="test">
INSERT INTO test.dbo.rawdata (locationid, date, data)
VALUES ('#form.locaitonid#', #DateValue#, '#Form["data" & onerow]#'')
</CFQUERY>
</CFLOOP>
This is the code for getting the raw data into the table.
<CFLOOP INDEX="onerow" FROM="1" TO="#form.numrows#">
<CFQUERY NAME="insertrawdata" DATASOURCE="test">
INSERT INTO test.dbo.rawdata (locationid, date, data)
VALUES ('#form.locaitonid#', #DateValue#, '#Form["data" & onerow]#'')
</CFQUERY>
</CFLOOP>