Hi, is it possible to list the results by date? So i would like to download the results in csv between 2 date.
I tried to use views for it, but there is no data module for drupal 7

Comments

quicksketch’s picture

Title: Get form results by date » Add date range or "last X submissions" to CSV/Excel download
Category: support » feature

I know there was an issue for this already but I can't find it any longer. We'll make this the new official thread I suppose unless the other one can be found again.

Webform currently does not have this ability, but it's a valid feature request. I'd like to add this as an option when you download the results, but instead of doing a date range I'm inclined to do an option for "download last X submissions", which would default to the number of submissions since the last download. It wouldn't be as flexible as a date range, but I think it's the most common scenario.

vernond’s picture

Several ways to go with this:
a) include only submissions since this particular users last download;
b) include only submissions from specified submission number;
c) include only the last specified number of submissions;
d) include only submissions in a specified date range.

If we need to go to the trouble of storing the last submission downloaded by a specific user in any case, we could probably cater for at least 3 out of the 4 options without too much extra effort... I think. Something along the lines of a select list and one textfield in an additional fieldset added to the download page should do it (which would perforce exclude the date range option).

I'm ready to tackle this now if you guys are happy with my take on it.

quicksketch’s picture

@vernond: Sure if you want to attempt I'm excited to see what you come up with. Where do you plan to store the last download ID? A new table?

vernond’s picture

Status: Active » Needs work
StatusFileSize
new21.74 KB
new11.44 KB

D7 git patch attached. I'll roll D6 version when we're happy with everything.

According to my testing almost everything works as it should (including update and install).

Problem I'm having is that successive download requests occasionally borks the browser (see page_not_found image). Either I have done something wrong somewhere, or there is an issue with the javascript that manages the overlay. Any insights, tips, corrections will be GREATLY appreciated!

Saoirse1916’s picture

Count me among those needing this for D6.

EDIT: Check that, I applied the patch at http://drupal.org/files/issues/381068_webform_export_date_11.patch and it works perfectly.

quicksketch’s picture

Interface-wise, I think making this similar to other locations where we have a combination of text + choice would be a good idea. See the radio-buttons combined with textfields used to enter e-mail from/name/address choices for example.

So it would look like this when finished:

(•) All submissions
( ) Only new submissions since last download
( ) Only the latest [   ] submissions
( ) All submissions from [   ] onward
( ) All submissions from [   ] to [   ]

I also think we could combine a couple of these options (like the last two). We could also combine "Only new" in here by prepopulating a number into the "All submissions from [ ] onward" that defaulted to the last downloaded number.

So a possible revised UI might look like this:

(•) All submissions
( ) Only the latest [   ] submissions
( ) All submissions starting from #[ 87 ] to (optional) end #[   ]

I'm open to alternative improvements, but this seems like it would be consistent with our other UIs.

shawnb’s picture

vernond,

Have a look at lines 711-712 of the patched webform.report.inc. There are two condition calls for 'nid': one checking against $node->nid and the other against $user->uid.

vernond’s picture

@ShaunB - nice catch, thanks.

@quicksketch - Your UI suggestions make good sense, I'll be back with changes shortly.

quicksketch’s picture

@vernond: I'm not 100% sure about removing "Only new submissions since last download"... seems like it's a lot more clear than my suggestion but I would find it helpful as a user if I knew what "since last download" meant (like the submission number). I'm interested in any improvements you can make on top of the proposed approach.

vernond’s picture

Status: Needs work » Needs review
StatusFileSize
new16.88 KB
new15.7 KB

@quicksketch - I compromised (see sad tale below) and we now have four options looking like so:
(*) All submissions (x total)
( ) Only new submissions since your last download (y new)
( ) Only the latest [ ] submissions
( ) All submissions starting from: [ ] to (optional) end: [ ]

The "Only new submissions since..." option is automatically disabled if there are no new transactions.

I nearly got shot on Friday for defaulting the number of new transactions into "Only the latest [ ] submissions" because of the following scenario, hence the compromise:
a) user went to download page;
b) user interrupted by 10 minute telephone call;
c) call followed by 15 minute email blame-storming session;
d) user clicked Download;
e) Download excluded 3 submissions that came in during the interruption period (one of which was from some VIP);
f) Attendee name badges where printed via mail-merge and Mr. VIP had a hand-written name badge... (cue hysterics).

vernond’s picture

@quicksketch - I think we should probably also include the timestamp of the last download, e.g.:
( ) Only new submissions since your last download (12 new since 09:45 21 Aug 2011)

Seems that it would be useful information to have, particularly on a site with many Webforms. Agree?

vernond’s picture

Needed to re-upload patch file (don't work if filename has a pound sign) in any case, so here's a patch including the last downloaded timestamp

vernond’s picture

@quicksketch - Webform 6.x-3.x patch attached as well (leaving the issue version as the original 7).

vernond’s picture

Committed to both branches

vernond’s picture

Status: Needs review » Fixed

New webform releases for D6 and D7 include this feature.

Status: Fixed » Closed (fixed)

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