I assume you are viewing a parent record when you want to initiate this process.

When you are on this form for the parent record, there is a global variable named

**kRid **which represents the

**[Record ID#]** of the record being displayed. So the conceptual inputs for this script are (1)

**kRid **along with (2) the child dbid (

**cdbid**) and (3) the field id (

**fid**) of the single field in the child table you want to calculate statistics on.

Using this library for the statistics calculations:

http://www.javascriptstats.com

the code in the following entry will calculate all of you basic statistics such as mean, median, mode, min, max, range, sum, sumOfSquaresm, variance, standard deviation

**Pastie Database**https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=237In a nutshell the code above waits till the statistics library has loaded and the child data has arrived and then calculates each of the above statistics using underscore and the stats library. Once the statistics are calculated you can splice the results into the form or perform an AJAX call to stuff the results into a table, user defined page or wherever you want it to go.