Download Results by field key instead of label

daengo - November 4, 2009 - 23:20
Project:Webform
Version:6.x-2.8
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Does anyone have any suggestions (e.g. code snippet) on how to export results and download the file with the field key instead of the label?
For example, getting a field key like 'program_completion' in the excel or text file instead of the entire question like 'What is your anticipated date of graduation or program completion?'. This would make the file much cleaner.

#1

daengo - November 10, 2009 - 19:01
Status:active» closed

I found the answer.
Find the file in the components folder for your component (i.e. select.inc, textfield.inc, textarea.inc, etc). Open the file and find
function _webform_csv_headers_ (the function will be different depending on which component type. For example function _webform_csv_headers_select for a select component). Change $header[2] = $component['name'] to $header[2] = $component['form_key'];. This must be done for all component types in your webform. Go back to the file download. Download the file and the form_key will be in the headers instead of the 'name'. You could also decide whether to remove the extra headers or leave them.

 
 

Drupal is a registered trademark of Dries Buytaert.