Comments

star-szr’s picture

Unintended "feature": You can add hidden columns to the report to exclude them from the "all columns" CSV export. Works for me :)

star-szr’s picture

StatusFileSize
new849 bytes

Small patch on top of original to at least document this.

star-szr’s picture

StatusFileSize
new680 bytes

Sorry for the mess, I forgot to exclude markup fields. One more patch.

vako’s picture

I see that it will be an option, so people can choose to print or not the hidden columns. Thanks for the idea and the patch. Hope it will be tested and committed.

star-szr’s picture

Title: Add option to export all columns in CSV export » Add option to export all columns (webform components) in CSV export

Thanks Vako. Changing the title to more accurately describe this feature. Not sure if it makes sense to incorporate in the module but I thought I'd share anyway.

star-szr’s picture

Combining the three patches into one, got rid of trailing whitespace as well. If you are using this in combination with hidden fields, you will need the patch from http://drupal.org/node/1175514#comment-4544734 to get everything lining up nicely in your CSV exports.

star-szr’s picture

Regarding #3 - maybe we don't want to exclude markup fields after all. I forgot that you can use tokens and PHP code to customize these, so it might be useful to be able to export these as well.

jimbullington’s picture

Thank you for the suggestion and the patch. I was wondering if you would consider putting this option on the CSV Export Options form instead of the Report Criteria form since the option is only valid for a CSV export. Putting it there would probably simplify the change as well...

star-szr’s picture

StatusFileSize
new3.78 KB

Thanks for the feedback, I agree. This probably isn't an option that many will use, so it makes sense to be tucked away. In my case I will just do a hook_form_alter to check that box by default.

The attached patch moves the checkbox to the report criteria form, and improves the wording slightly. I kept in the exclusion of markup components because it looks like webform report doesn't support displaying them anyway.

jimbullington’s picture

Thanks for the revision!

I don't really like having another function that duplicates a good bit of the _webform_report_get_columns() function, but I can't think of a better way - without making it messy.

One more thing - what do you think about including hidden fields as well? I was thinking, if the user says All Columns, then we should output all columns. You could just set hidden to false, or just remove it from the _webform_report_get_all_columns() output array.

star-szr’s picture

Regarding duplicating the _webform_report_get_columns() function, I couldn't think of a better way either, which is why they are separate.

Including hidden fields as well would make much more sense, and that might be where our codebase has to diverge. I'm dealing with a handful of massive multi-page webforms where I need to show only a few columns in the web report, and show almost all the columns in the exports. With the implementation in #9 this is easy to do, because even the end user can specify the fields to be hidden from exports fairly easily. I think the only other way of hiding columns would be (possibly) via custom PHP code.

I will upload a revised patch for you later this week that exports all columns.

star-szr’s picture

StatusFileSize
new3.66 KB

Here is the revised patch. I'm not sure if we need the description for the checkbox on the export CSV form, but I'll leave that up to you.

kenorb’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.

vako’s picture

I would like to have this feature in all versions of webform and committed to code, would it be possible??

kenorb’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Closed (outdated) » Active
kenorb’s picture

Status: Active » Needs work

The patch needs porting to Drupal 7 then.