I'm loving the new conditional features of the module, but I just tried exporting to CSV for the first time from my new big conditional survey and it appears that the export is missing placeholders for the questions that have dependencies and weren't answered by the respondent.

This is tough to illustrate, but I'll try my best. I've attached the exported XLS file to this issue. You can probably tell that in the last set of questions (Archery Experience, etc.) these questions are conditional and depend up which sports the user was interested in in the previous page of the webform. The problem, however, is that the responses for these last questions are displayed one right after the next and aren't positioned in the correct columns. I think we're just missing placeholders for the questions that the user wasn't expected to answer.

I'll take a look and see if I can figure out where that needs to take place w/in the module. Just wanted to be sure to go ahead and file an issue for it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

attheshow’s picture

Status: Active » Needs review
FileSize
687 bytes

Oh, ok, I think I found it actually. Here's a patch.

quicksketch’s picture

Thanks, I'll need to review this and try to figure out what that IF statement is trying to accomplish. It was clearly put in there for some particular reason, it doesn't seem right that we'd just be able to remove an entire conditional. It surely had or has some purpose for being in there.

attheshow’s picture

Yeah, I figured it probably did too, but wasn't able to determine what the purpose was. Thanks for looking at this.

quicksketch’s picture

Category: bug » support
Status: Needs review » Fixed

Hmmm, upon investigating this problem, that line doesn't even have the code that you've removed. It seems that your module may have been hacked and is no longer a stock installation.

This line is already what you're suggesting and has never been changed since beta 1. See http://drupalcode.org/viewvc/drupal/contributions/modules/webform/includ...

attheshow’s picture

Category: support » bug
Status: Fixed » Needs review
FileSize
783 bytes

Sorry, looks like my diff was accidentally done in reverse. Here's the correct patch:

quicksketch’s picture

It looks to me like this patch will have the odd side-effect of causing elements that don't add values to the CSV download (but can be used with conditional) add empty columns to the CSV. This includes things like page breaks and fieldsets.

quicksketch’s picture

This patch takes a different approach, where we check hook_webform_component_info() and simply ask if a component supports CSV downloads. Regardless of whether that component decides to actually put anything into the CSV, a column is always added for that component.

quicksketch’s picture

Patch for above comment

quicksketch’s picture

Status: Needs review » Fixed

I've tested this patch but I couldn't actually reproduce the problem described with or without it applied. However it should solve the problem because the approach is similar to what was suggested in #5. Regardless of a field returning a value, it will get a column.

I also like this improvement because it means that any module can implement hook_webform_component_info_alter() and set 'csv' to FALSE to disable CSV functionality for any component. I've committed this patch so we can get out a beta 6 release.

attheshow’s picture

Great. Thanks for your help! I'll check out the new beta.

Status: Fixed » Closed (fixed)

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