I do not understand how webform exports the data... I create a form with items in a certain order -weight , within fieldsets, etc... but when I have input and view the results in analysis, table, or as an exported cvs, the data is not kept in the order I created the webform; so it makes no sense for human readability. Is this a feature i am missunderstanding? Is there a way to get results in the order i created the items? Thank you

Comments

quicksketch’s picture

Version: 5.x-1.2 » 5.x-1.3
Category: support » bug
Priority: Critical » Normal

Yes I think this is still a problem in 1.3. The analysis and table views seem to be reasonably ordered, but the CSV doesn't seem to make any sense.

GTAce’s picture

Table and download (export) are sorted by submission, which kind of makes sense...but the analysis results is what I think is really strange...It is first sorted by question and then alphabetically (completely ignores the weights). Does anybody know how to sort those results by weight instead of name?

roginald’s picture

I noticed this problem as well on a couple of my forms. What I found my problem to be was, that I thought I was being clever by taking advantage of using weights inside of fieldsets and thinking that I could only be concerned with a fields 'local' weight. This is certainly the case for viewing a webform, however not the case when viewing the table or downloading to csv.

In short, I was able to fix the problem by making sure to use only 1 set of weights, making sure that the order I wanted the fields to be exported was reflected in the weights. This resulted in some rather large weight numbers, but at least it works.

quicksketch’s picture

Clever solution roginald. I'll try to fix this when time allows so you won't have to jump through such hoops. Thanks for sharing though!

vipconsult’s picture

.

mandclu’s picture

Version: 5.x-1.3 » 5.x-1.7

Just subscribing to this thread, as this appears to still be an issue.

jpsalter’s picture

I missed this issue and posted this as a feature request. I got the sorting needed with a simple fix (slightly hackish).

http://drupal.org/node/207766

mandclu’s picture

Confirmed, that solves the issue for me too. Thanks!

quicksketch’s picture

Status: Active » Closed (duplicate)

This patch actually was the one that got in: http://drupal.org/node/190193

mandclu’s picture

Status: Closed (duplicate) » Active

Are you sure these issues are duplicates? The one you refer to seems to be related to order problems derived from how select lists are handled, whereas this is more to do with ordering problems that derive from how fieldsets are handled. In my mind, both are issues that need to be fixed.

Firetracker’s picture

Hi,

I'm having this problem with both 5.x-1.7 and 5.x-1.8.

Both Table and CSV do not seem display in any order or follow the layout of the page.

Help!

Cheers
Zapple

quicksketch’s picture

Status: Active » Needs review

Thanks for reopening. The problem definitely still existed. I had a hand at this (and several other issues on the plane) and committed it all to CVS. Unfortunately I don't have a patch for the fix as it was bundled with several others. If you could try out the latest dev version or try it out from CVS I'd appreciate confirmation the problem has been solved. Thanks!

Firetracker’s picture

Hi Quicksketch,

If you are wanting to list by weight only and are listing EVERY item in order, then the following code works:

$query = 'SELECT cid, name, type, extra FROM {webform_component} WHERE nid = %d ORDER BY weight';

However this doesn't work with Nested weights (in fieldsets) which is what I had originally. I've not tested your dev version with Nested weights because there seems to be a bug with the weights on main edit page of the form.

If I try to update a weight or make a field mandatory in the edit page, then submit the page to update it, none of the values are submitted. This is not the case when editing a component directly which work fine.

Cheers
Zap

quicksketch’s picture

Yeah after researching a bit, there isn't an easy way to do nested structures in SQL unless you've got stored procedures at your disposal. Taxonomy module does it by repeated SQL queries for each level of the tree. But rather than doing it in SQL at all, I left it pulling normally all at once then using the existing webform sorting functions to turn it into a tree. Once it's a tree I flatten it again maintaining the same correct order.

...because there seems to be a bug with the weights on main edit page of the form.

Could you elaborate what this problem is in the dev version?

quicksketch’s picture

Marked http://drupal.org/node/180236 as duplicate.

Firetracker’s picture

HI Quicksketch,

Thanks for the quick repsonse!

If I change the weight or tick a mandatory field option in the main node/*/edit form, then hit submit nothing gets updated.

I'm taking a guess here but...if you edit these in the component they are pushed to memory then only stored when the node is updated. However on the actual node form they need to inserted directly upon hitting the submit.

Cheers
Zap

quicksketch’s picture

Hey zapple, I'm fairly sure I corrected that problem in the dev version, though it is definitely an issue in 1.8. Regardless, could you try out the dev version to see if form ordering is corrected? If the checkbox issue still exists, please open a separate ticket. Thanks!

Firetracker’s picture

Hi Quicksketch,

Just to let you know that the weights & mandatory fields on the main edit page are working fine in the Dev build from 24th January.

Cheers for all your help.
Zap

quicksketch’s picture

Status: Needs review » Fixed

Rock, closing out.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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