fieldid = $this->field->id; $content->recordid = $recordid; $content->content = (float)$value; if ($oldcontent = get_record('data_content','fieldid', $this->field->id, 'recordid', $recordid)) { $content->id = $oldcontent->id; return update_record('data_content', $content); } else { return insert_record('data_content', $content); } } function get_sort_sql($fieldname) { global $CFG; switch ($CFG->dbtype) { case 'mysql': // string in an arithmetic operation is converted to a floating-point number return '('.$fieldname.'+0.0)'; default: return 'CAST('.$fieldname.' AS REAL)'; } } } ?>