def applyPercentToRecords( dbid, numericField, percentField, 
                                             query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil) 
      fieldNames = Array[numericField]
      total = sum( dbid, fieldNames, query, qid, qname, clist, slist, fmt, options )
      fieldNames << "3" # Record ID#
      iterateRecords( dbid, fieldNames, query, qid, qname, clist, slist, fmt, options ){|record|
         result = percent( [total[numericField],record[numericField]] )
         clearFieldValuePairList
         addFieldValuePair( percentField, nil, nil, result.to_s )
         editRecord( dbid, record["3"], fvlist )
      }
   end
def applyPercentToRecords( dbid, numericField, percentField, 
                                             query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil) 
      fieldNames = Array[numericField]
      total = sum( dbid, fieldNames, query, qid, qname, clist, slist, fmt, options )
      fieldNames << "3" # Record ID#
      iterateRecords( dbid, fieldNames, query, qid, qname, clist, slist, fmt, options ){|record|
         result = percent( [total[numericField],record[numericField]] )
         clearFieldValuePairList
         addFieldValuePair( percentField, nil, nil, result.to_s )
         editRecord( dbid, record["3"], fvlist )
      }
   end
Query records, sum the values in a numeric field, calculate each record's percentage
 of the sum and put the percent in a percent field each record.