Hello everyone, my name is Luke and I have a problem with the export in csv module and webform table element.
The results are correct, but when there is a new application after the table element, export the results in the cells moves to the right, misaligning the results with the questions.

I have webform with 4 table element 4.

thanks

Comments

Behfar’s picture

Issue summary: View changes

Added versions of Webform and Table Element

Behfar’s picture

I found the function Webform executes when exporting results and through some use of print_r, I think I've found the issue but still have no idea how to fix it:

(The function call is webform_results_download_rows and it's located in webform/includes/webform.report.inc)

I did a comparison with a three-row Table Element with each row containing one text field versus another three-row Table Element with each row containing one checkbox list with three options to select from.

It looks like when I'm using checkboxes, it creates one more array which isn't parsed by the exporter. I have no idea what to do about this.

Behfar’s picture

I think I've fixed it!!

It required an addition to the _webform_csv_data_table_element function located in webform_table_element.module

original code snippet:

	foreach ($all_data as $key => $data) {
		$table[$key][] = strip_tags($data) . "\n";
	}

modified code snippet:

	foreach ($all_data as $key => $data) {
		if(is_array($data))
		{
			$data = implode(",", $data);
		}
		$table[$key][] = strip_tags($data) . "\n";
	}
Behfar’s picture

Assigned: Unassigned » Behfar
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

lucasc82’s picture

Title: Checkboxes will not export to CSV or Excel » export to CSV or Excel wrond data next Fields
Issue summary: View changes
ssoulless’s picture

Hi was this commited?