fields('t')
    ->condition('template_id', $variables['template_id'], '=')
    ->execute()
    ->fetchObject();
  $template->template_array = unserialize($template->template_array);
  // Summarize Template
	$fields = array();
	$constants = array();
	foreach ($template->template_array as $priority => $table_array) {
		if (!is_array($table_array)) {
			continue;
		}
		$table = $table_array['table'];
		$record = $table_array['record_id'];
		foreach ($table_array['fields'] as $field) {
			if (preg_match('/table field/', $field['type'])) {
				$field['table'] = $table;
				$field['record'] = $record;
				$sheet = 0;//$field['spreadsheet sheet'];
				$column = $field['spreadsheet column'];
				$fields[$sheet.'-'.$column][] = $field;
			} elseif ($field['type'] == 'constant') {
				$field['table'] = $table;
				$field['record'] = $record;
				$constants[] = $field;
			}
		}
	}
?>
  Template Description
  
  
  Constants -These values are applied to all records in the Data File
    | Record Name | Field Name | Value | Chado Database | 
|---|
    | Table | Field | 
|---|
    
    
      
				|  |  |  |  |  | 
      
    
  
  
  Fields -Below is a mapping between Data File columns and the Chado Database
  | Record Name | Field Name | Data File Column | Chado Datbase | 
|---|
  | Table | Field | 
|---|
  
  
    
    
    	|  |  |  |  |  |